Update everything, improve autocomplete and snippets.

This commit is contained in:
Dan Chadwick
2024-11-11 12:05:28 -05:00
parent 63ae70fc67
commit a088a7565a
8 changed files with 107 additions and 109 deletions

View File

@@ -1,44 +1,18 @@
return {
{
"hrsh7th/cmp-nvim-lsp"
},
{
"L3MON4D3/LuaSnip",
dependencies = {
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets"
}
},
{
"hrsh7th/nvim-cmp",
lazy = false,
priority = 100,
dependencies = {
"onsails/lspkind.nvim",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
{ "L3MON4D3/LuaSnip", build = "make install_jsregexp" },
"saadparwaiz1/cmp_luasnip",
},
config = function()
local cmp = require("cmp")
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
-- { name = 'nvim_lsp' },
-- { name = 'vsnip' }, -- For vsnip users.
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
})
})
require "dan.completion"
end
},
}
}