diff options
author | kylo252 <[email protected]> | 2021-10-29 19:33:00 +0200 |
---|---|---|
committer | kylo252 <[email protected]> | 2021-10-30 14:39:00 +0200 |
commit | 377cab434c79aa537820ba21bbcc44261304ed09 (patch) | |
tree | 4361d6101ec999ba74ae1cc1c8d00aa9366d3752 /lua/lvim/core | |
parent | ffd1d5e16522f7c03603c183eec237d529dbe1e3 (diff) |
feat: update now syncs the core plugins (#1865)
Diffstat (limited to 'lua/lvim/core')
-rw-r--r-- | lua/lvim/core/autopairs.lua | 16 | ||||
-rw-r--r-- | lua/lvim/core/cmp.lua | 2 |
2 files changed, 6 insertions, 12 deletions
diff --git a/lua/lvim/core/autopairs.lua b/lua/lvim/core/autopairs.lua index eb080fb1..51649790 100644 --- a/lua/lvim/core/autopairs.lua +++ b/lua/lvim/core/autopairs.lua @@ -4,8 +4,6 @@ function M.config() lvim.builtin.autopairs = { active = true, on_config_done = nil, - ---@usage auto insert after select function or method item - map_complete = true, ---@usage -- modifies the function or method delimiter by filetypes map_char = { all = "(", @@ -52,14 +50,12 @@ M.setup = function() end), } - if package.loaded["cmp"] then - require("nvim-autopairs.completion.cmp").setup { - map_cr = false, - map_complete = lvim.builtin.autopairs.map_complete, - 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 }) + local cmp_status_ok, cmp = pcall(require, "cmp") + if cmp_status_ok then + -- If you want insert `(` after select function or method item + local cmp_autopairs = require "nvim-autopairs.completion.cmp" + local map_char = lvim.builtin.autopairs.map_char + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = map_char }) end require("nvim-treesitter.configs").setup { autopairs = { enable = true } } diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index 57fb70c4..68c695cb 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -161,8 +161,6 @@ M.config = function() select = false, }, completion = { - ---@usage vim's `completeopt` setting. Warning: Be careful when changing this value. - completeopt = "menu,menuone,noinsert", ---@usage The minimum length of a word to complete on. keyword_length = 1, }, |