Operative
Operative

Reputation: 149

change vim keybindings for particular file type

I want to change some key bindings for .adb files, this is for ada. So how do I do it just for this and not for any other filetype. Also How would I disable some default features for this filetype?

Upvotes: 2

Views: 654

Answers (2)

Ingo Karkat
Ingo Karkat

Reputation: 172520

To add to @Amit's answer: Define all mappings via :noremap <buffer> ... and any commands with :command -buffer; this way, they will be scoped to the (current) buffer.

Otherwise, when you edit ada and other (say, HTML or C) files in parallel, the (global) mappings will "seep" into the other buffers, and you won't be able to define the same mapping for multiple filetypes.

Upvotes: 1

Amit
Amit

Reputation: 20456

Create a ada.vim plugin in ~/.vim/ftplugin/ada.vim and add your .ada specific key bindings there.

You would also need to have filetype plugin on or filetype plugin indent on in your .vimrc

Upvotes: 2

Related Questions