mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-18 01:38:57 +00:00
31 lines
619 B
Lua
31 lines
619 B
Lua
local M = {}
|
|
|
|
local function do_setup(opts, validate)
|
|
for mod, elem in pairs(opts) do
|
|
for key, val in pairs(type(elem) == 'table' and elem or {}) do
|
|
local opt = 'matchup_'..mod..'_'..key
|
|
if validate and vim.g[opt] == nil then
|
|
error(string.format('invalid option name %s.%s', mod, key))
|
|
end
|
|
vim.g[opt] = val
|
|
end
|
|
end
|
|
end
|
|
|
|
function additional_setup()
|
|
require'match-up.which-key'.setup_which_key()
|
|
end
|
|
|
|
function M.setup(opts)
|
|
local sync = opts.sync
|
|
if sync then
|
|
vim.cmd[[runtime! plugin/matchup.vim]]
|
|
end
|
|
|
|
do_setup(opts, sync)
|
|
|
|
additional_setup()
|
|
end
|
|
|
|
return M
|