[nvim] fix: snippets config
This commit is contained in:
parent
6581d9af42
commit
6fd5067bc4
|
@ -20,8 +20,7 @@ local f = ls.function_node
|
|||
|
||||
local copy = utils.copy
|
||||
|
||||
ls.snippets = {
|
||||
c = {
|
||||
ls.add_snippets( "c", {
|
||||
s("main", {
|
||||
t({ "int main(int argc, char* argv[])" }),
|
||||
t({ "", "{", "\t" }),
|
||||
|
@ -47,5 +46,6 @@ ls.snippets = {
|
|||
t({ "", "\treturn 0;"}),
|
||||
t({ "", "}"}),
|
||||
}),
|
||||
},
|
||||
}
|
||||
}, {
|
||||
key = "c"
|
||||
})
|
||||
|
|
|
@ -44,8 +44,7 @@ local function rec_ls()
|
|||
)
|
||||
end
|
||||
|
||||
ls.snippets = {
|
||||
tex = {
|
||||
ls.add_snippets("tex", {
|
||||
-- rec_ls is self-referencing. That makes this snippet 'infinite' eg. have as many
|
||||
-- \item as necessary by utilizing a choiceNode.
|
||||
s("ls", {
|
||||
|
@ -125,5 +124,6 @@ ls.snippets = {
|
|||
i(1),
|
||||
t({ "}"}),
|
||||
}),
|
||||
},
|
||||
}
|
||||
}, {
|
||||
key = "tex"
|
||||
})
|
||||
|
|
|
@ -59,15 +59,13 @@ local function date_input(fmt)
|
|||
return sn(nil, i(1, os.date(fmt)))
|
||||
end
|
||||
|
||||
ls.snippets = {
|
||||
-- When trying to expand a snippet, luasnip first searches the tables for
|
||||
-- each filetype specified in 'filetype' followed by 'all'.
|
||||
-- If ie. the filetype is 'lua.c'
|
||||
-- - luasnip.lua
|
||||
-- - luasnip.c
|
||||
-- - luasnip.all
|
||||
-- are searched in that order.
|
||||
all = {
|
||||
-- snippets are added via ls.add_snippets(filetype, snippets[, opts]), where
|
||||
-- opts may specify the `type` of the snippets ("snippets" or "autosnippets",
|
||||
-- for snippets that should expand directly after the trigger is typed).
|
||||
--
|
||||
-- opts can also specify a key. By passing an unique key to each add_snippets, it's possible to reload snippets by
|
||||
-- re-`:luafile`ing the file in which they are defined (eg. this one).
|
||||
ls.add_snippets( "all", {
|
||||
-- trigger is fn.
|
||||
s("fn", {
|
||||
-- Simple static text.
|
||||
|
@ -321,8 +319,9 @@ ls.snippets = {
|
|||
"fmt6",
|
||||
fmt("use {} only", { t("this"), t("not this") }, { strict = false })
|
||||
),
|
||||
},
|
||||
}
|
||||
}, {
|
||||
key = "all",
|
||||
})
|
||||
|
||||
-- autotriggered snippets have to be defined in a separate table, luasnip.autosnippets.
|
||||
ls.autosnippets = {
|
||||
|
|
Reference in New Issue