mirror of
https://github.com/iofq/nvim.nix.git
synced 2026-01-23 08:55:16 -06:00
use kickstart-nix
This commit is contained in:
parent
53bfda8bcd
commit
b33413dd18
36 changed files with 1291 additions and 519 deletions
37
nvim/plugin/luasnip.lua
Normal file
37
nvim/plugin/luasnip.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
if vim.g.did_load_luasnip_plugin then
|
||||
return
|
||||
end
|
||||
vim.g.did_load_luasnip_plugin = true
|
||||
|
||||
local ls = require("luasnip")
|
||||
ls.config.set_config {
|
||||
history = true,
|
||||
updateevents = "TextChanged, TextChangedI",
|
||||
}
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
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})
|
||||
|
||||
--------------------
|
||||
-- Snippets --
|
||||
--------------------
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
ls.add_snippets("go", {
|
||||
ls.snippet("ie", fmta("if err != nil {\n\treturn <err>\n}", { err = ls.insert_node(1, "err") })),
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue