28 lines
1.2 KiB
Lua
28 lines
1.2 KiB
Lua
|
return {
|
||
|
-- extend auto completion
|
||
|
{
|
||
|
"hrsh7th/nvim-cmp",
|
||
|
opts = function(_, opts)
|
||
|
local cmp = require("cmp")
|
||
|
opts.mapping = vim.tbl_deep_extend("force", opts.mapping, {
|
||
|
["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||
|
["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||
|
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||
|
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||
|
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||
|
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||
|
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||
|
["<C-e>"] = cmp.mapping({
|
||
|
i = cmp.mapping.abort(),
|
||
|
c = cmp.mapping.close(),
|
||
|
}),
|
||
|
-- Accept currently selected item. If none selected, `select` first item.
|
||
|
-- Set `select` to `false` to only confirm explicitly selected items.
|
||
|
["<Tab>"] = cmp.mapping.confirm({ select = true }),
|
||
|
-- Disabel Enter key for autocomplete
|
||
|
["<CR>"] = cmp.mapping.close(),
|
||
|
})
|
||
|
end,
|
||
|
},
|
||
|
}
|