nvim: plugins: Switch to luasnip

This commit is contained in:
Sanchayan Maity 2021-10-18 10:43:20 +05:30
parent 8e1f6a8834
commit bfb4d258b3
3 changed files with 12 additions and 14 deletions

View file

@ -1,5 +1,10 @@
local cmp = require 'cmp'
local lspkind = require 'lspkind'
local luasnip = require 'luasnip'
-- https://github.com/hrsh7th/nvim-cmp/issues/180#issuecomment-915405589
luasnip.config.set_config { history = true }
require('luasnip.loaders.from_vscode').load {}
cmp.setup {
preselect = cmp.PreselectMode.None,
@ -14,7 +19,7 @@ cmp.setup {
nvim_lsp = '[Lsp]',
nvim_lua = '[Lua]',
path = '[Path]',
vsnip = '[Snippet]',
luasnip = '[Snippet]',
})[entry.source.name]
vim_item.kind = lspkind.presets.default[vim_item.kind]
return vim_item
@ -22,7 +27,7 @@ cmp.setup {
},
snippet = {
expand = function (args)
vim.fn["vsnip#anonymous"](args.body)
luasnip.lsp_expand(args.body)
end
},
documentation = {
@ -42,7 +47,7 @@ cmp.setup {
priority = 100
},
{
name = 'vsnip',
name = 'luasnip',
priority = 80
},
{

View file

@ -87,12 +87,6 @@ vim.g.vimtex_view_general_options = '--unique \\@pdf\\#src:@tex:@line:@col'
vim.g['sneak#label'] = 1
vim.g['sneak#s_next'] = 1
vim.g['sneak#use_ic_scs'] = 0
-- vsnip settings
vim.g.vsnip_filetypes = {
javascriptreact = {'javascript'},
typescript = {'javascript'},
typescriptreact = {'javascript', 'javascriptreact', 'typescript'}
}
-- dirvish
vim.g.dirvish_relative_paths = 1
-- dispatch

View file

@ -23,9 +23,11 @@ local init = function ()
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-vsnip',
'hrsh7th/cmp-path',
'onsails/lspkind-nvim'
'onsails/lspkind-nvim',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
'rafamadriz/friendly-snippets'
}
}
-- Git support
@ -122,9 +124,6 @@ local init = function ()
use {
'chentau/marks.nvim',
}
-- Snippets
use 'hrsh7th/vim-vsnip'
use 'rafamadriz/friendly-snippets'
-- For files with ANSI escape sequences
use {
'powerman/vim-plugin-AnsiEsc',