In Vim, you can make it so each time you write “FF” on insert mode changes to some code by using:
:iab FF for ( int i = 0 ; i < n ; i++ )
But is there any way to use this with arguments? Something like C’s #defines, so if I write
FF(e, 10)
It becomes:
for ( int e = 0 ; e < 10 ; e++ )
Take a look at SnipMate (a vim plugin). You won’t get arguments, but upon expansion of an abbreviation, it allows you to tab through modifiable areas. In the
forexample, you’ll be brought to theifirst, can edit it to bee, and it will change it toein all areas of thefordeclaration. Then simply tab to the next area you’d like to change.From the docs:
The following is a nice helpful change to remap
tabands-tabtoc-dandc-a, in case you don’t want to lose the functionality oftab(in~/.vim/after/plugin/snipMate.vim):