Keyan wrote:
> hi,
>
> i have the following problem. when i edit cpp/perl/java or other source code 
> files, i like to have my { on separate lines, i.e.:
>
> function () 
> {
>   // bla
> }
>
> so i use
>
> inoremap { ^M{^M}<ESC>O
>
> in my ftplugin files.
>
> now, when i document my stuff, i use tex, in which i dont want the have the { 
> } on a separate line. if i include an
>
> iunmap {
>
> in my tex.vim, i get an error, if  the inoremap { was not set before, lets 
> say, when i only work on .tex files, without switching between .cpp and .tex.
>
> summarised, i want the inoremap { function (or something similar) active on a 
> set of files, and not active in another set, but without error messages.
>
> is there a nice way to handle this?
>   
You want to use the <buffer> modifier to the map.  I suggest placing the map

inoremap <buffer> { ^M{^M}<ESC>O

into  .vim/ftplugin/cpp.vim   so it is only activated in C++ buffers; 
the <buffer> qualifier will keep its effect there.

Regards,
Chip Campbell


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to