Search code examples
c++vimpluginsfile-type

Vim how to run/load certain plugins on certain filetypes?


I was wondering if it's possible to only run/load certain plugins for certain filetypes? For example, I have YouCompleteMe and Syntastic installed via Vundle, but I only want to load them when I'm actually editing a C++ file.

It doesn't just limit it to just those plugins, it could be basically anything. The reason for this is because I want to minimize the amount of plugins loaded for other files, otherwise it'll be loaded for a file say, .txt even though there's really no point in doing so (which also means that things will be faster :) )

Thanks.


Solution

  • It is trivial with NeoBundle. Here is an example from :help :NeoBundleLazy:

    NeoBundleLazy 'Rip-Rip/clang_complete'
    autocmd FileType c,cpp NeoBundleSource clang_complete
    

    You can very easily convert your Vundle setup to NeoBundle, seeing how the latter is a fork of the former.