You can write filetype plugins for the languages you'd like abbreviations for.
There's a full section in the documentation about this - type :help ftplugin
within vim, or see it online. The ftplugins are named after the filetype they run for, for example cpp.vim
for C++ code.
If this is just for you, you can place your filetype plugin in ~/.vim/ftplugin
. For a example, for ~/.vim/ftplugin/cpp.vim
you could write:
ab begincode int main () { return 1; };
ab authorheader /* Programmer: nXqd */
...
If you're interested, you can see all the built-in filetype plugins in the vim install's ftplugin directory - on most systems, that's /usr/share/vim/vimXX/ftplugin
, where vimXX is the vim version (e.g. vim72 for Vim 7.2). If you have any additional ones installed system-wide, they'd be in /usr/share/vim/vimfiles/ftplugin
.