Question

I am using snipmate plugin with vim. How can I write any commands in snipmate snippet that I would be able to write to .vimrc? Like <ESC>, <leader>, <cr> and so on...

I want to be able to write a snippet that imports python debugger, sets trace and then returns to normal mode. I struggle with returning to normal mode. I have no idea how to code it using snipmate.

Basically I would want something like this, however this won't work properly:

snippet pdb
    import pdb; pdb.set_trace()<ESC>

This will just add '<ESC>' at the end, but I want to return to normal mode instead. Is this possible?

Was it helpful?

Solution

snipMate snippets are like the built-in :abbreviate on steroids, usually with parameter insertions, mirroring, and multiple stops inside them. It appears that you don't need all this advanced functionality here, so instead you would be better served with a plain insert-mode abbreviation, where you can indeed use the Vim key-notation:

:ia pdb import pdb; pdb.set_trace()<ESC>

With snipMate itself, leaving insert mode is not possible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top