nvim-snippy
nvim-snippy copied to clipboard
normal mode after completing snippet :question:
Is there a way to switch to normal mode and not stay in insert mode after ending a snippet completion ? It would like to be able to do that for specific snippets.
Hi, thanks for the question. No, currently there's no way to do that, regardless of which mode you expand the snippet from. If there is a $0 tab stop, the cursor jumps to it, otherwise it jumps to the end of the snippet.
I can see you might need/want that feature if your snippet contains no editable tab stops, just variables/eval blocks. For example, I think it would be great for using snippets as file templates.
For normal usage, however, I don't know if that feature would be very useful, unless you explain what you want to achieve in a bit more detail.
actually I still would like to use snippets with editable tabs stops, but after ending the snippet (like reaching $0), I would like to go back to normal mode. For example I use sql snippets, I use a plugin that is able to run them to see their result either if they are in some code, so I don't always want to stay in insert mode.
There is now the SnippyFinished autocmd. The user can set up it like this to enter normal mode after ending the snippet:
autocmd User SnippyFinished call feedkeys("\<Esc>", 'n')