mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
nvim/golang: lazy load snippets only once
This commit is contained in:
parent
d0fdbc5f34
commit
088c91531d
1 changed files with 8 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
vim.bo.expandtab = false
|
vim.bo.expandtab = false
|
||||||
|
|
||||||
do
|
local once = require("once")
|
||||||
|
once.test_and_load("ft_go", function()
|
||||||
local luasnip = require("luasnip")
|
local luasnip = require("luasnip")
|
||||||
local s = luasnip.snippet
|
local s = luasnip.snippet
|
||||||
local t = luasnip.text_node
|
local t = luasnip.text_node
|
||||||
|
|
@ -9,9 +10,12 @@ do
|
||||||
|
|
||||||
luasnip.add_snippets("go", {
|
luasnip.add_snippets("go", {
|
||||||
s("ie", {
|
s("ie", {
|
||||||
t("if err != nil {"), cr(),
|
t("if err != nil {"),
|
||||||
t("\t"), i(0), cr(),
|
cr(),
|
||||||
|
t("\t"),
|
||||||
|
i(0),
|
||||||
|
cr(),
|
||||||
t("}"),
|
t("}"),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
end
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue