diff --git a/home/.config/nvim/autopairs.vim b/home/.config/nvim/autopairs.vim index e10220e..a3cf6c5 100644 --- a/home/.config/nvim/autopairs.vim +++ b/home/.config/nvim/autopairs.vim @@ -1,10 +1,15 @@ +" off with +nmap :lua require('nvim-autopairs').disable() +" on with +nmap :lua require('nvim-autopairs').enable() + +" fix being not usable to select a completion item +inoremap coc#pum#visible() ? coc#pum#confirm() : + \ "\u\=v:lua.require'nvim-autopairs'.autopairs_cr()\" + lua << EOF require("nvim-autopairs").setup {} local Rule = require('nvim-autopairs.rule') local npairs = require('nvim-autopairs') npairs.add_rule(Rule("<>","<>","rs")) EOF - -" fix being not usable to select a completion item -inoremap coc#pum#visible() ? coc#pum#confirm() : - \ "\u\=v:lua.require'nvim-autopairs'.autopairs_cr()\" diff --git a/home/.config/nvim/utils.lua b/home/.config/nvim/utils.lua new file mode 100644 index 0000000..2ba735e --- /dev/null +++ b/home/.config/nvim/utils.lua @@ -0,0 +1,11 @@ +local utils = {} + +function M.map(mode, lhs, rhs, opts) + local options = { noremap = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +return utils