user9392253
user9392253

Reputation:

How do I selectively load vim plugins?

I am using vim-plug and I want to load a certain plugin only for some specific files. How can I do that?

Suppose I have plugin A. How can I load plugin A only for python and cpp? Similarly, can I prevent vim from loading some plugin B for html and php files?

Upvotes: 1

Views: 1288

Answers (2)

loudmummer
loudmummer

Reputation: 544

From the README file of vim-plug:

" On-demand loading
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }

This did not help me much, so I looked elsewhere.

Apparently there is a filetype plugin option used to define behaviour specific to filetypes. So, to add settings for .py files, add filetype plugin on in .vimrc and create ~/.vim/ftplugin/py.vim to add settings there.

Upvotes: 1

nameless1
nameless1

Reputation: 203

autocmd FileType cpp,py source  pluginAPath

Upvotes: 1

Related Questions