Created
May 20, 2024 20:10
-
-
Save tjdevries/cd030fa1f9ee8a8d8885e74dfa2324eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ls = require "luasnip" | |
vim.snippet.expand = ls.lsp_expand | |
---@diagnostic disable-next-line: duplicate-set-field | |
vim.snippet.active = function(filter) | |
filter = filter or {} | |
filter.direction = filter.direction or 1 | |
if filter.direction == 1 then | |
return ls.expand_or_jumpable() | |
else | |
return ls.jumpable(filter.direction) | |
end | |
end | |
---@diagnostic disable-next-line: duplicate-set-field | |
vim.snippet.jump = function(direction) | |
if direction == 1 then | |
if ls.expandable() then | |
return ls.expand_or_jump() | |
else | |
return ls.jumpable(1) and ls.jump(1) | |
end | |
else | |
return ls.jumpable(-1) and ls.jump(-1) | |
end | |
end | |
vim.snippet.stop = ls.unlink_current |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment