I have recently started using VIM as my text editor and am currently working on my own customizations.
I suppose keyboard mappings can do pretty much anything, but for the time being I'm using them as a sort of snippets facility almost exclusively.
So, for example, if I type def{TAB}
(:imap def{TAB} def ():<ESC>3ha
), it expands to:
def |(): # '|' represents the caret
This works as expected, but I find it annoying when VIM waits for a full command while I'm typing a word containing "def" and am not interested in expanding it.
- Is there a way to avoid this or use this function more effectively to this end?
- Is any other VIM feature better suited for this?
After taking a quick look at SnippetsEmu, it looks like it's the best option and much easier to customize than I first thought.
To continue with the previous example:
:Snippet def <{}>():
Once defined, you can expand your snippet by typing def{TAB}
.