.config/nvim/lua/config/util.lua

changeset 1095
226221dc1d6b
parent 1085
c2d11f022cf0
child 1156
0a7162df160d
equal deleted inserted replaced
1094:694fb6cd9cc2 1095:226221dc1d6b
1 local M = {} 1 local M = {}
2 2
3 local api = vim.api 3 local api, fn = vim.api, vim.fn
4 local fn = vim.fn
5 4
6 function M.calias(abbrev, expand) 5 function M.calias(aliases)
7 vim.cmd.cnoreabbrev( 6 for abbrev, expand in pairs(aliases) do
8 string.format( 7 vim.cmd.cnoreabbrev(
9 [[<expr> %s (getcmdtype() == ":" && getcmdline() == "%s") ? "%s" : "%s"]], 8 string.format(
10 abbrev, 9 [[<expr> %s (getcmdtype() == ":" && getcmdline() == "%s") ? "%s" : "%s"]],
11 abbrev, 10 abbrev,
12 expand, 11 abbrev,
13 abbrev 12 expand,
13 abbrev
14 )
14 ) 15 )
15 ) 16 end
16 end 17 end
17 18
18 function M.autocmd(group, event, pattern, opts) 19 function M.autocmd(group, event, pattern, opts)
19 if type(opts) == "function" then 20 if type(opts) == "function" then
20 local func = opts 21 local func = opts

mercurial