diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-10-11 22:03:16 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-10-11 22:03:16 +0200 |
commit | df66b461596d351367f90d41a0fabffb873de4be (patch) | |
tree | 711b15790bb97ba0bfa57e1e863fe9a521d55bec /.config/nvim/lua/core/autopairs.lua | |
parent | 611b15e94dadc7351d5ff67f268791d5269ea112 (diff) |
Merge updates from lunarvim
Diffstat (limited to '.config/nvim/lua/core/autopairs.lua')
-rw-r--r-- | .config/nvim/lua/core/autopairs.lua | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/.config/nvim/lua/core/autopairs.lua b/.config/nvim/lua/core/autopairs.lua index 0c9ec28..630f3de 100644 --- a/.config/nvim/lua/core/autopairs.lua +++ b/.config/nvim/lua/core/autopairs.lua @@ -4,14 +4,8 @@ function M.config() options.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,17 @@ M.setup = function() if package.loaded["cmp"] then require("nvim-autopairs.completion.cmp").setup { - map_cr = options.builtin.autopairs.map_cr, + map_cr = false, map_complete = options.builtin.autopairs.map_complete, - auto_select = options.builtin.autopairs.auto_select, - insert = options.builtin.autopairs.insert, map_char = options.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 } } |