Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manually and conditionally load plugins for Vim

Tags:

vim

I have two different projects that I'm working on (let's call them projA and projB) that have their own Vim plugins.

Each plugin folder has an ftdetect, ftplugin, plugin and syntax subfolder, and each deals with the same type of files (.cpp, .html, etc).

If I load both sets of plugins then nothing I want works right so I need a way to only load the plugin that corresponds to the project I'm working on.

My idea is to detect what my current working directory is via getcwd() and then only load the relevant plugin, but I have no idea how to manually load a single plugin.

I'm currently using Vundle to manage the rest of my plugins.

like image 513
skeletalmonkey Avatar asked Dec 10 '25 21:12

skeletalmonkey


1 Answers

With vim-plug

The vim-plug plugin manager supports loading plugins conditionally.

This is straight from their readme:

" On-demand loading
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
like image 81
Matthias Braun Avatar answered Dec 13 '25 13:12

Matthias Braun