Vim package management

Wellcome back, it’s been a week since my first post. This week i want to write about new vim 8 pacakge management.

Before vim 8, to manage plugins, normally you need to install a third-party plugin management such as Pathogen, vim-plug… but starting from vim 8, you can use built-in vim package management to do that.

First, let’s upgrade vim to version 8. You can install it using your OS package management (pacman, brew, …), just make sure it is version 8.

I should probably introduce more about vim, but there are some plugins i can’t live without so I need to setup package management first. I promise i will introduce how to use vim later.

Here is how vim 8 package management work:

└── pack
    └── anhduy
        ├── opt
        └── start
  • anhduy: You can name this directory whatever you want, vim doesn’t care about this folder name.
  • start: Always loaded plugins directory: put the plugin you want vim to load here.
  • opt: Optional plugins directory: vim will not load plugins inside this folder unless you ask it to by running :packadd.

Now, if you want to install ctrlp, just clone it into start and vim will autoload it.

Try another one, clone Tagbar into opt, then confirm that you can’t run :Tagbar until you run :packadd tagbar first.

That’s all of it, now you can use plugins with vim itself without any other tools.

Questions from (imagination) readers:

Q: What do you mean by "clone it into start"?
A: That's a git specific term, basically it mean you copy the whole folder and put it inside start directory.
Q: Can vim package management allow me to define plugins in vimrc or have command to download plugins?
A: No, it only know how to load your plugins.
Q: So now my vimrc isn't the source of truth, which defined all my vim config anymore?
A: ...
Q: If i use this, how can i copy by vimrc to a server and use it, before that i have vim-plug download everything for me
A: ... ...
An early converted reader: I removed vim-plug and use vim 8 pacakge management now, it works fine, but how can i update my plugins?
A: ... ... ...
Another early converted: This thing is useless, it can't update my plugins likes vim-plug. How can i update my plugin :rage: ?
A: :dont-know: :who-care:
Others: Wait, wait, I don't understand, what should i do now, please answer above questions :crying:
A: :dun-care: :dun-care: :running-away:

Thanks for reading, see you again next time on how to setup and use vim as main editor.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.