Vim: different key mapping for different window

Posted by rahul on Stack Overflow See other posts from Stack Overflow or by rahul
Published on 2010-06-08T04:56:45Z Indexed on 2010/06/08 5:02 UTC
Read the original article Hit count: 273

Filed under:

My .vimrc file has filetype mappings for different filetypes such as :

autocmd FileType sh map gf ... autocmd FileType ruby map gf ...

While rewriting a program from one language to another, I have 2 splits, one with a shell script and one with ruby. I would assume that "gf" would take on its mapping based on filetype. However, it can only hold one mapping at a time.

Is there any way to declare a mapping only for the existing file/window. I tried ":windo" and ":bufdo" but they work for all windows or buffers.

© Stack Overflow or respective owner

Related posts about vim