Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Examples/snippets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ ls.add_snippets("all", {
}, {
condition = conds.line_begin,
}),
s("cond3", {
t("will only expand at the end of the line"),
}, {
condition = conds.line_end,
}),
-- The last entry of args passed to the user-function is the surrounding snippet.
s(
{ trig = "a%d", regTrig = true },
Expand Down
2 changes: 1 addition & 1 deletion doc/luasnip.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*luasnip.txt* For NVIM v0.5.0 Last change: 2022 September 08
*luasnip.txt* For NVIM v0.5.0 Last change: 2022 September 14

==============================================================================
Table of Contents *luasnip-table-of-contents*
Expand Down
5 changes: 5 additions & 0 deletions lua/luasnip/extras/expand_conditions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ function M.line_begin(line_to_cursor, matched_trigger)
return line_to_cursor:sub(1, -(#matched_trigger + 1)):match("^%s*$")
end

function M.line_end(line_to_cursor)
local line = vim.api.nvim_get_current_line()
return #line_to_cursor == #line
end

return M