Split snippets config out of completions config
This commit is contained in:
26
lua/plugins/snippets.lua
Normal file
26
lua/plugins/snippets.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
return {
|
||||
'L3MON4D3/LuaSnip',
|
||||
name = 'LuaSnip',
|
||||
build = 'make install_jsregexp',
|
||||
config = function()
|
||||
local luasnip = require('luasnip')
|
||||
luasnip.setup({})
|
||||
|
||||
-- Load snippets
|
||||
local opts = { paths = vim.fn.stdpath('config') .. '/snippets' }
|
||||
require('luasnip.loaders.from_snipmate').lazy_load(opts)
|
||||
require('luasnip.loaders.from_lua').lazy_load(opts)
|
||||
|
||||
-- Snippet keybindings
|
||||
vim.keymap.set({ 'i', 's' }, '<C-j>', function()
|
||||
if luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { silent = true })
|
||||
vim.keymap.set({ 'i', 's' }, '<C-K>', function()
|
||||
if luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { silent = true })
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user