We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4b1a284 + 7117f5e commit 14b801fCopy full SHA for 14b801f
Examples/snippets.lua
@@ -326,6 +326,11 @@ ls.add_snippets("all", {
326
}, {
327
condition = conds.line_begin,
328
}),
329
+ s("cond3", {
330
+ t("will only expand at the end of the line"),
331
+ }, {
332
+ condition = conds.line_end,
333
+ }),
334
-- The last entry of args passed to the user-function is the surrounding snippet.
335
s(
336
{ trig = "a%d", regTrig = true },
lua/luasnip/extras/expand_conditions.lua
@@ -5,4 +5,9 @@ function M.line_begin(line_to_cursor, matched_trigger)
5
return line_to_cursor:sub(1, -(#matched_trigger + 1)):match("^%s*$")
6
end
7
8
+function M.line_end(line_to_cursor)
9
+ local line = vim.api.nvim_get_current_line()
10
+ return #line_to_cursor == #line
11
+end
12
+
13
return M
0 commit comments