Hello,
Alexey Vakhov <[EMAIL PROTECTED]> wrote:
> I want to add simple code snippets. For example if I press <CR>{ I
> want to extend this to
> {
> <--- cursor
> }
> How can I make this by simplest way?
The simpliest way ? Well, it probably consists in using one of the numerous c or
C++ ftplugins out-there.
I'm maintening a C&C++ ftplugin suite [1] that proposes such a mapping (on {, (,
...), except that it won't expand in string/comment contexts, it can be
dynamically toggled on and off, it also inserts placeholders (/markers), the
usual control-statements (for, if, try, ...) are also provided (in insertion
mode, and also in other modes for surrounding purpose).
The code of the suite is definitivelly not that simple, but it does the job, and
much more.
HTH,
[1] http://hermitte.free.fr/vim/ressources/lh-cpp.tar.gz
PS: someday I'll eventually update the latest version of the suite.
--
Luc Hermitte
http://hermitte.free.fr/vim/