after luasnip
This commit is contained in:
parent
0abe06adc2
commit
21e4fcc3e0
29
nvim/.config/nvim/after/plugin/luasnip.lua
Normal file
29
nvim/.config/nvim/after/plugin/luasnip.lua
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
local ls = require "luasnip"
|
||||||
|
|
||||||
|
ls.config.set_config {
|
||||||
|
history = true,
|
||||||
|
updateevents = "TextChanged,TextChangedI",
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.keymap.set({ 'i', 's' }, "<c-k>", function()
|
||||||
|
if ls.expand_or_jumpable() then
|
||||||
|
ls.expand_or_jump()
|
||||||
|
end
|
||||||
|
end, { silent = true })
|
||||||
|
|
||||||
|
vim.keymap.set({ 'i', 's' }, "<c-j>", function()
|
||||||
|
if ls.jumpable(-1) then
|
||||||
|
ls.jump(-1)
|
||||||
|
end
|
||||||
|
end, { silent = true })
|
||||||
|
|
||||||
|
vim.keymap.set({ 'i', 's' }, "<c-l>", function()
|
||||||
|
if ls.choice_active() then
|
||||||
|
ls.change_choice(1)
|
||||||
|
end
|
||||||
|
end, { silent = true })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>ss", "<cmd>source ~/.config/nvim/after/plugin/luasnip.lua<CR>",
|
||||||
|
{ desc = "[S]nippets [s]ource" })
|
||||||
|
|
||||||
|
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })
|
3
nvim/.config/nvim/snippets/lua/snippets.lua
Normal file
3
nvim/.config/nvim/snippets/lua/snippets.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
return {
|
||||||
|
s("ct", t "-- TODO: ")
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user