I have following line in my vimrc-
autocmd BufRead,BufNewFile *.COB,*.PCO set filetype=cobol "force filetype as cobol for .COB and .PCO files
And I have put below lines in my custom plugin at the beginning (~/.vim/plugin/cobmods.vim)
if &ft != "cobol"
finish
endif
I don't want the plugin to load for other filetypes but this code doesn't work. I have tried putting the plugin inside ~/.vim/after/plugin so that it loads last but still it doesn't work.
Is there any different event that I am supposed to use?
Note: I have used below code inside the plugin and it works fine
if expand('%:e') != 'COB' && expand('%:e') != 'PCO'
finish
endif
But this doesn't look like the right way.
Also note: I can't change filetype.vim to include *.COB & *.PCO as I don't have the adequate rights as this resides in the installation location and not my home directory.
~/.vim/filetype.vim
, in your home directory?