Hellinga.IT

Technology, Security, Pentesting, Write-ups, etc.

Vim 8.x moving to a native configuration

2019-01-04 tech Lammert Hellinga

I’ve been using vim for many years now. (Still) learning more about it every day. Once you use vim for a while, you start putting configuration in your personal vimrc. This configuration usually consists of keybindings, plugin configuration, etc.

Up until the release of vim 8.x if you wanted to use plugins, it was useful and a timesaver to use a plugin manager like Vundle, Pathogen or the like.

Vim 8.x however has native support for packages, among other things a package can be a git, mercurial, etc. repository which makes it easy to manage and update. See this link for more information or just type :help packages in vim itself.

My configuration has been a growing and living document for many years, usually adding bits and pieces, but never removing them. I was still using Vundle for managing my plugins as well, even though I’m using vim 8.x for quite a while now. I had nearly 25 plugins installed, some with their own settings in the config.

I finally took some time to clean up my vimrc and change to the native package support in vim.

My .vim directory now looks like this, as you can see I’ve greatly reduced the number of plugins:

.
├── pack
│   └── my-plugins
│       ├── opt
│       │   └── httplog
│       └── start
│           ├── ctrlp.vim
│           ├── salt-vim
│           ├── syntastic
│           ├── vim-airline
│           ├── vim-airline-themes
│           ├── vim-arduino-syntax
│           ├── vim-flake8
│           ├── vim-monokai-phoenix
│           └── YouCompleteMe
└── vimrc

The vimrc file contains my vim settings, keybindings, little scripts, etc. What’s new is the pack directory, this contains one subdirectory my-plugins but you can name this directory however you like.

Inside that directory 2 directories:

  • opt - these plugins are loaded on demand with the :packadd command
  • start - these plugins are loaded automatically upon starting vim

The directories beneath that are git submodules in my case, which allows me to easily update all my plugins using:

git submodule update --recursive --remote

My configuration has become much smaller and I’ve removed a lot of plugins and themes which I wasn’t using anymore. Plugin management has become easier and by using submodules it’s also easier to deploy my vim config on other machines.

If you want to take a look at my config for inspiration or to use it yourself, it can be found on my github.

And of course a screenshot: vim