diff options
author | Chase Colman <[email protected]> | 2021-10-10 02:47:01 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2021-10-09 20:47:01 +0200 |
commit | 82b7a35858479223c1e34bea2f64451ecf1e5f66 (patch) | |
tree | c0aaaed1e0eefe10320044236bdabaa545935f0b /lua/core/autopairs.lua | |
parent | 484c618d09150980746afd37b34b96f1ce15b81d (diff) |
fix(cmp/autopairs): prevent out of bounds jump and re-enable jump after confirm (#1708)
Diffstat (limited to 'lua/core/autopairs.lua')
-rw-r--r-- | lua/core/autopairs.lua | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lua/core/autopairs.lua b/lua/core/autopairs.lua index a67f3b07..eb080fb1 100644 --- a/lua/core/autopairs.lua +++ b/lua/core/autopairs.lua @@ -4,14 +4,8 @@ function M.config() lvim.builtin.autopairs = { active = true, on_config_done = nil, - ---@usage map <CR> on insert mode - map_cr = true, ---@usage auto insert after select function or method item map_complete = true, - ---@usage automatically select the first item - auto_select = true, - ---@usage use insert confirm behavior instead of replace - insert = false, ---@usage -- modifies the function or method delimiter by filetypes map_char = { all = "(", @@ -60,12 +54,12 @@ M.setup = function() if package.loaded["cmp"] then require("nvim-autopairs.completion.cmp").setup { - map_cr = lvim.builtin.autopairs.map_cr, + map_cr = false, map_complete = lvim.builtin.autopairs.map_complete, - auto_select = lvim.builtin.autopairs.auto_select, - insert = lvim.builtin.autopairs.insert, map_char = lvim.builtin.autopairs.map_char, } + -- we map CR explicitly in cmp.lua but we still need to setup the autopairs CR keymap + vim.api.nvim_set_keymap("i", "<CR>", "v:lua.MPairs.autopairs_cr()", { expr = true, noremap = true }) end require("nvim-treesitter.configs").setup { autopairs = { enable = true } } |