updates cmp

This commit is contained in:
Henrik Bakken
2022-04-19 15:06:52 +02:00
parent 632048e7f0
commit 3e7049a241
+20 -10
View File
@@ -533,29 +533,39 @@ require("packer").startup {
end end
} }
use {"L3MON4D3/LuaSnip"}
-- autocompletion -- autocompletion
use { use {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
requires = { requires = {
{"L3MON4D3/LuaSnip"}, {"hrsh7th/cmp-path", after = "nvim-cmp"}, {"hrsh7th/cmp-path", after = "nvim-cmp"},
{"hrsh7th/cmp-buffer", after = "nvim-cmp"}, {"hrsh7th/cmp-buffer", after = "nvim-cmp"},
{"hrsh7th/cmp-calc", after = "nvim-cmp"} {"hrsh7th/cmp-calc", after = "nvim-cmp"}
}, },
config = function() config = function()
local cmp = require("cmp") local cmp = require("cmp")
cmp.setup({ cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end
},
sources = { sources = {
{name = "nvim_lsp"}, {name = "luasnip"}, {name = "buffer"}, {name = "nvim_lsp"}, {name = "buffer"}, {name = "path"},
{name = "path"}, {name = "nvim_lua"} {name = "nvim_lua"}
} }
}) })
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
end end
} }