mirror of https://github.com/LazyVim/starter
18 lines
652 B
Lua
18 lines
652 B
Lua
-- Options are automatically loaded before lazy.nvim startup
|
|
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
|
-- Add any additional options here
|
|
function leave_snippet()
|
|
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
|
|
|
|
-- stop snippets when you leave to normal mode
|
|
vim.api.nvim_command([[
|
|
autocmd ModeChanged * lua leave_snippet()
|
|
]])
|