cmp and autopairs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
local cmp = require "cmp"
|
||||
local cmp_lsp = require "cmp_nvim_lsp"
|
||||
local cmp_kinds = require("assets.icons").icons.kinds
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
|
||||
local function flatten_to_array(t)
|
||||
local res = {}
|
||||
@@ -133,9 +134,22 @@ cmp.setup {
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
["<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,
|
||||
},
|
||||
},
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
@@ -165,6 +179,7 @@ cmp.setup {
|
||||
{ name = "nvim_lua" },
|
||||
},
|
||||
}
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
vim.diagnostic.config {
|
||||
virtual_text = false,
|
||||
|
||||
Reference in New Issue
Block a user