mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
use the more sane snippet session logic
This commit is contained in:
parent
a50f92f755
commit
5a708b199e
1 changed files with 14 additions and 0 deletions
|
|
@ -105,3 +105,17 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
|||
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Use the more sane snippet session leave logic. Copied from:
|
||||
-- https://github.com/L3MON4D3/LuaSnip/issues/258#issuecomment-1429989436
|
||||
vim.api.nvim_create_autocmd('ModeChanged', {
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
if ((vim.v.event.old_mode == 's' and vim.v.event.new_mode == 'n') or vim.v.event.old_mode == 'i')
|
||||
and require('luasnip').session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
and not require('luasnip').session.jump_active
|
||||
then
|
||||
require('luasnip').unlink_current()
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue