refactor(nvim): use shorthand variables

I'm not sure if I like this, but it's less characters and seems to be
the convention with LuaSnip which will make it easier if introducing
snippets from any examples or anyone else's dotfiles.
This commit is contained in:
Oliver Davies 2022-01-09 22:46:33 +00:00
parent 0808e54b4e
commit 9b4fadfa28
2 changed files with 16 additions and 16 deletions

View file

@ -1,9 +1,9 @@
local luasnip = require "luasnip"
local fmta = require("luasnip.extras.fmt").fmta
local luasnip = require "luasnip"
local insert = luasnip.insert_node
local snippet = luasnip.snippet
local i = luasnip.insert_node
local s = luasnip.snippet
return {
snippet({ trig = "log", dscr = "console.log" }, fmta("console.log(<>);", { insert(1, "value") })),
s({ trig = "log", dscr = "console.log" }, fmta("console.log(<>);", { i(1, "value") })),
}

View file

@ -1,13 +1,13 @@
local luasnip = require "luasnip"
local fmta = require("luasnip.extras.fmt").fmta
local luasnip = require "luasnip"
local choice = luasnip.choice_node
local insert = luasnip.insert_node
local snippet = luasnip.snippet
local text = luasnip.text_node
local c = luasnip.choice_node
local i = luasnip.insert_node
local s = luasnip.snippet
local t = luasnip.text_node
return {
snippet(
s(
"test",
fmta(
[[
@ -17,13 +17,13 @@ return {
}
]],
{
choice(1, {
text "test",
text "it",
text "should",
c(1, {
t "test",
t "it",
t "should",
}),
insert(2),
insert(0),
i(2),
i(0),
}
)
),