mirror of
https://github.com/LazyVim/starter.git
synced 2026-07-25 14:01:03 +00:00
clear snippets on normal mode
This commit is contained in:
parent
4c3b0b98fe
commit
98cfe8617f
1 changed files with 14 additions and 0 deletions
|
|
@ -1,3 +1,17 @@
|
|||
-- 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()
|
||||
]])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue