mirror of
https://github.com/gabehf/nvim-conf.git
synced 2026-03-07 21:48:17 -08:00
remove cmp <CR> select
This commit is contained in:
parent
d2c7d4a064
commit
bf82c7d7e1
1 changed files with 30 additions and 0 deletions
30
lua/plugins/cmp.lua
Normal file
30
lua/plugins/cmp.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
config = function(_, opts)
|
||||
local cmp = require "cmp"
|
||||
opts.mapping["<CR>"] = cmp.mapping {
|
||||
i = function(fallback)
|
||||
if cmp.visible() and cmp.get_active_entry() then
|
||||
cmp.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false }
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
s = cmp.mapping.confirm { select = true },
|
||||
c = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true },
|
||||
}
|
||||
opts.mapping["<Tab>"] = cmp.mapping(function(fallback)
|
||||
-- This little snippet will confirm with tab, and if no entry is selected, will confirm the first item
|
||||
if cmp.visible() then
|
||||
local entry = cmp.get_selected_entry()
|
||||
if not entry then
|
||||
cmp.select_next_item { behavior = cmp.SelectBehavior.Select }
|
||||
end
|
||||
cmp.confirm()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s", "c" })
|
||||
require("cmp").setup(opts)
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue