Switch to luasnip

This commit is contained in:
Alexander Gehrke 2023-08-18 14:45:05 +02:00
parent cf181c41b7
commit f3923dd425
3 changed files with 10 additions and 14 deletions

View file

@ -4,14 +4,8 @@ local cmp = require'cmp'
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
-- For `vsnip` user. --vim.fn["vsnip#anonymous"](args.body)
vim.fn["vsnip#anonymous"](args.body) require('luasnip').lsp_expand(args.body)
-- For `luasnip` user.
-- require('luasnip').lsp_expand(args.body)
-- For `ultisnips` user.
-- vim.fn["UltiSnips#Anon"](args.body)
end, end,
}, },
mapping = { mapping = {

View file

@ -45,7 +45,6 @@ local on_attach = function(client, bufnr)
map("n", "<leader>aw", function() vim.diagnostic.setqflist({ severity = "W" }) end, opts) map("n", "<leader>aw", function() vim.diagnostic.setqflist({ severity = "W" }) end, opts)
map("n", "<leader>ae", function() vim.diagnostic.setqflist({ severity = "E" }) end, opts) map("n", "<leader>ae", function() vim.diagnostic.setqflist({ severity = "E" }) end, opts)
vim.cmd [[autocmd BufEnter,BufWrite <buffer> lua vim.lsp.codelens.refresh()]]
vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]] vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]]
vim.cmd [[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]] vim.cmd [[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]]
end end

View file

@ -11,9 +11,11 @@ return {
'hrsh7th/cmp-buffer', 'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path', 'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-cmdline',
'hrsh7th/cmp-vsnip', -- 'hrsh7th/cmp-vsnip',
'hrsh7th/vim-vsnip', -- 'hrsh7th/vim-vsnip',
'hrsh7th/vim-vsnip-integ', -- 'hrsh7th/vim-vsnip-integ',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
'onsails/lspkind.nvim', 'onsails/lspkind.nvim',
{ {
'zbirenbaum/copilot-cmp', 'zbirenbaum/copilot-cmp',
@ -42,7 +44,8 @@ return {
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
vim.fn["vsnip#anonymous"](args.body) --vim.fn["vsnip#anonymous"](args.body)
require('luasnip').lsp_expand(args.body)
end, end,
}, },
mapping = { mapping = {
@ -65,7 +68,7 @@ return {
}, },
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'vsnip' }, { name = 'luasnip' },
{ name = "copilot" }, { name = "copilot" },
}, { }, {
{ name = 'buffer' }, { name = 'buffer' },