vendredi 22 septembre 2017

Adopting vim native package management.

OK, today, I switch to Vim 8 native package management.

Before, I used Pathogen with controversial git submodule feature.

I think it's always better to use native features instead of third party ones, even if I never had any issue with Pathogen.

If you have a similar configuration, just type following commands to switch (assuming your modules are in .vim/bundle directory)

cd ~/.vim  # go to your vim config directory
mkdir -p pack/myplugs/start  # create a pack dir for plugin loading on startup
for DIR in bundle/*; do git mv $DIR pack/myplugs/start; done  # move every submodule from bundle to pack keeping git aware 

You may have to update your git submodules if they emptied in the process:

git submodule update --recursive --remote

Then edit your ~/.vimrc file to remoce call to pathogen

" remove this line
call pathogen#infect() 

Rerun vim, to check if everything is OK for you. Cleaning the .vim directory is left as an exercise.

Native package management feature adds plugins to the runtime path at startup for bundles stored in .vim/pack/whatever/start. You can also configure optional module by putting them in .vim/pack/whatever/opt. If you put a module foodebug in that directory, you have to activate it manually with command:

:packadd foodebug

You could achieve the same with Pathogen though.

Unfortunately, using packages loaded at vim startup does not make their documentation directly available with :h command. To do so, it seems you have to manually update your help tags using:

:helptags ~/.vim/pack