I want to set the following matchpairs
option in vim only if filetype is PHP.
set matchpairs+==:;
Is it possible to do it?
I tried to read the documentation for matchpairs
but it doesn't seem to mention any such option.
The best way to customize settings by filetype is using droping a file into your ftplugin
folder of your runtime folder. Normally ~/.vim/ftplugin
The file must be named as the file type, so if you were doing this for Ruby, you would have ~/.vim/ftplugin/ruby.vim
Just make sure that your have support for filetypes
:filetype plugin on
And! Maybe instead of using set
commands, you will want to use setlocal
so the effects stays only within the current buffer.
Add this to your .vimrc
:
autocmd FileType php setlocal matchpairs+==:;
But if you have more settings you want to set for a specific filetype, you should save them in ~/.vim/ftplugin/YOUR_LANGUAGE.vim
(without the autocmd FileType YOUR_LANGUAGE
prefix).