My 11 favourite Vim plugins
Tags: tools, vim
Published: 2021-11-23 22:48:09

---
title: My 11 favourite Vim plugins
published: true 
date: 2021-06-03 21:11:49 UTC
tags: tools,vim
canonical_url: https://www.solarwinter.net/my-11-favourite-vim-plugins/
---

 ![My 11 favourite Vim plugins](https://www.solarwinter.net/content/images/2021/06/My-11-favourite-Vim-plugins.png)

While I’m spending most of my JavaScript writing time in WebStorm these days, I still use Vim a lot. Over time I’ve found some great plugins, extending Vim to cope with an amazing amount of stuff.

I should note that these are all essentially general purpose plugins. Some of the language-specific ones are great to use, but unless you’re working with that particular language they’re not going to be that useful.

Any screenshots are taken from the plugin website, rather than grabbed by me, unless explicitly noted.

## Plug

This is where it all starts. It’s very simple to use - I don’t think I’ve ever had to change a setting.

Once you’ve added the plugin section to your `.vimrc` adding a new plugin is simple, especially if it’s on Github:

```
call plug#begin("~/.vim/plugged")
	Plug 'foo/bar'
call plug#end()

```

(It will handle arbitrary Git servers as well.)

`Plug` takes care of downloading and installing the plugin. If a plugin needs a few options then that’s easily taken care of too.

```
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }

```

Once you’ve got it set up just `:PlugInstall` to install plugins, and `:PlugUpgrade` to upgrade. Simples, just the way I like it.

[Get Plug here](https://github.com/junegunn/vim-plug).

## General functionality.

These plugins cover Vim “as a whole” - they’ll improve your whole Vim experience.

### startify

Startify has a simple goal - on startup it presents a list of most-recently-used files and sessions.

I started using this fairly recently, and it’s surprisingly useful - I’d probably use it for the `SSave` and `SLoad` functions alone (storing Vim sessions in a dedicated session directory). As an added bonus it even recognises if there’s an existing `Session.vim` file in the directory you’ve launched it from and offers that as an extra option.

![My 11 favourite Vim plugins](https://www.solarwinter.net/content/images/2021/06/startify-menu.png)

[Get Startify here](https://github.com/mhinz/vim-startify).

### NERDTree

NERDTree is a better file sidebar. It makes it easy to delete/add/rename files and directories, change the Vim working directory (useful for launching tools such as `grep`), and easy to navigate around the file structure. If you rename a file or directory and you’ve got buffers open with the old name it offers to reopen the buffers with the new name, which is a very nice touch.

![My 11 favourite Vim plugins](https://www.solarwinter.net/content/images/2021/06/nerdtree.png)

It offers integrated help - I’ve not had to resort to reading the fine manual. The only niggle I have is that the help is accessed via `?`, which is entirely reasonable but breaks backward search in the tree.

(It is quite possible the manual gives a way to change that, of course. Maybe I should read it…)

[Get NerdTree here](https://github.com/preservim/nerdtree).

### Obsession

One of Tim Pope’s plugins, which should be all you need to know about the quality of it. Once you start it in an editing session `Obsession` will automatically save any window/buffer/layout changes to the session file.

When used together with Startify it makes for a very smooth flow. Save the session file once and turn on Obsession - after that you can load it via the Startify menu buffer and everything’s set up right the way you left it last time you exited.

(And no more problems forgetting to save the session before that automatic `:qa`…)

[Get Obsession here](https://github.com/tpope/vim-obsession).

### markdown-preview.nvim

To be honest - this is way better than I expected a preview in Vim to be. Once you’ve started it opens a browser window, then automatically reloads the contents as you edit the document.

![My 11 favourite Vim plugins](https://www.solarwinter.net/content/images/2021/06/47603494-28e90000-da1f-11e8-9079-30646e551e7a.gif)

[Get markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).

## Coding

These plugins help with coding, rather than appearance or general text editing.

### CoC

Integrates support for [Language Servers](https://microsoft.github.io/language-server-protocol/), as used by VS Code, IntelliJ, Sublime Text and co. Language servers are what let the editors quickly and accurately auto-complete, suggesting type-compatible completions.

Basically - if you write code with Vim, you need this plugin.

![My 11 favourite Vim plugins](https://www.solarwinter.net/content/images/2021/06/coc-animation.gif)

[Get CoC](https://github.com/neoclide/coc.nvim).

### Vimagit

This is a port of (or ‘rewrite inspired by’) the Emacs `magit` extension. While it only does a subset of `magit` - it doesn’t do remote operations like push/pull/fetch, for example - it makes adding and committing to the repo really easy. I particularly like the fact you can stage whole files or individual hunks.

![My 11 favourite Vim plugins](https://www.solarwinter.net/content/images/2021/06/vimagit-animation.gif)

[Get Vimagit here](https://github.com/jreybert/vimagit).

### ALE

ALE is the Asynchronous Lint Engine. It provides background linting, syntax checking and semantic errors in recent versions of Vim, so the errors are flagged while you edit. This lets you fix them while the code is still (really!) fresh in your mind, rather than waiting for the next time you run `lint` or the static checker.

![My 11 favourite Vim plugins](https://www.solarwinter.net/content/images/2021/06/ale-animation.gif)

[Get ALE here](https://github.com/dense-analysis/ale).

## Appearance

Finally, we’re on to the plugins which change how Vim looks.

### Airline

Airline adds a status line to the bottom of each Vim window. Without any tweaking it’ll display:

- mode (normal/visual, that kind of thing)
- VCS info
- filename, filetype
- file encoding

It’s very configurable - you can probably get it to display just about anything that you’re interested in. It also plays well with others - for example, ALE above can be integrated into Airline to flag up warnings/errors in the status line.

Give it a try - just don’t blame me if you then spend the next day tweaking it to your exact satisfaction.

[Get Airline here](https://github.com/vim-airline/vim-airline).

### Themes

I find that I switch between themes depending on my mood, what I’m doing, and what the environment around me is like - for example, often light-background Papercolor is more readable than Solarized.

Luckily, this being Vim, it’s easy to write a couple of macros to switch between them and to set the background between light and dark.

For the themes I’m just going to add a screenshot from their homepage - there’s really not much I can say about these, other than I find them a good balance of colours.

#### Papercolor

Papercolor in light mode:

![My 11 favourite Vim plugins](https://www.solarwinter.net/content/images/2021/06/papercolor-light.png)

[Get Papercolor here](https://github.com/NLKNguyen/papercolor-theme).

#### Solarized

Solarized8 in light mode:

![My 11 favourite Vim plugins](https://www.solarwinter.net/content/images/2021/06/solarized8-light-1.png)

[Get Solarized8 here](https://github.com/lifepillar/vim-solarized8).

#### Dracula

![My 11 favourite Vim plugins](https://www.solarwinter.net/content/images/2021/06/screenshot.png)

[Get Dracula here](https://github.com/dracula/vim).

## Useful key mappings

### Themes and background

```
nnoremap <leader>tp :colorscheme PaperColor<CR>
nnoremap <leader>ts :colorscheme solarized8<CR>
nnoremap <leader>td :colorscheme dracula<CR>

nnoremap <leader>bd :set background=dark<CR>
nnoremap <leader>bl :set background=light<CR>

```

### Other stuff

Toggle NERDTree on and off; I have to admit I mostly just turn it on these days, but it’s nice to have the easy option.

```
nnoremap <leader>n :NERDTreeToggle<cr>

```

These I use more than I should, since I keep fiddling with my `.vimrc`. (Faux productivity for the win!)

```
nnoremap ,v :edit $MYVIMRC<CR>
nnoremap ,u :source $MYVIMRC<CR>

```