added bach nvim-cmp

This commit is contained in:
Ivar Fatland
2025-01-03 08:08:41 +01:00
parent da23dca25c
commit 3be42341e7
+33 -4
View File
@@ -227,8 +227,7 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require'lazy'.setup( require'lazy'.setup{
{
{ 'justinmk/vim-sneak', }, { 'justinmk/vim-sneak', },
{ 'michaeljsmith/vim-indent-object', }, { 'michaeljsmith/vim-indent-object', },
{ 'kylechui/nvim-surround', { 'kylechui/nvim-surround',
@@ -304,7 +303,7 @@ require'lazy'.setup(
config = function() config = function()
require'snippy'.setup{ enable_auto = true, } require'snippy'.setup{ enable_auto = true, }
vim.cmd [[ vim.cmd [[
imap <expr> <c-l> '<Plug>(snippy-expand-or-advance)' imap <expr> <c-l> '<Plug>(snippy-next)'
imap <expr> <c-k> '<Plug>(snippy-previous)' imap <expr> <c-k> '<Plug>(snippy-previous)'
smap <expr> <c-l> '<Plug>(snippy-next)' smap <expr> <c-l> '<Plug>(snippy-next)'
smap <expr> <c-k> '<Plug>(snippy-previous)' smap <expr> <c-k> '<Plug>(snippy-previous)'
@@ -334,5 +333,35 @@ require'lazy'.setup(
) )
end end
}, },
{ 'hrsh7th/nvim-cmp',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'dcampos/nvim-snippy',
'dcampos/cmp-snippy',
},
config = function()
local cmp = require'cmp'
cmp.setup{
snippet = {
expand = function(args)
require'snippy'.expand_snippet(args.body)
end,
},
mapping = {
['<C-y>'] = cmp.mapping.confirm{ select = true },
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
},
sources = cmp.config.sources{
{ name = 'snippy' },
{ name = 'nvim_lsp' },
{ name = 'buffer' },
{ name = 'path' },
},
} }
) end,
},
}