We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want basic feature like ${1:${VISUAL:val}}, It's hard to done with lua format for a beginner. now I found a way like this:
${1:${VISUAL:val}}
lua
d
index
default
sn_i_visual = function(index, default) return d(index, function(args, parent) local raw = parent.snippet.env.LS_SELECT_RAW if not raw or #raw == 0 then raw = default end return sn(nil, i(index, raw)) end) end
used in snippets: s("vimn", fmta("vim.notify(<>)", sn_i_visual(1, "abc"))),
s("vimn", fmta("vim.notify(<>)", sn_i_visual(1, "abc"))),
I found fmta is much friednly than fmt in lua
fmta
fmt
The text was updated successfully, but these errors were encountered:
Yes this is basically how I do it as well: https://github.com/bew/dotfiles/blob/b6df42b46e372f821f4744ae7283bcdbf6d47729/nvim-wip/lua/mycfg/snippets_by_ft/_utils.lua#L161-L175 I use LS_SELECT_DEDENT to make it easily work with indented selection. I also add an insert node after the 'visual' selection to have a 'tabstop', make it easier to add something after ;)
LS_SELECT_DEDENT
Sorry, something went wrong.
No branches or pull requests
I want basic feature like
${1:${VISUAL:val}}
, It's hard to done withlua
format for a beginner.now I found a way like this:
d
function withindex
anddefault
.used in snippets:
s("vimn", fmta("vim.notify(<>)", sn_i_visual(1, "abc"))),
I found
fmta
is much friednly thanfmt
inlua
The text was updated successfully, but these errors were encountered: