DEV Community

Cover image for Configuring NeoVim plugins
Bruno Baère
Bruno Baère

Posted on

Configuring NeoVim plugins

NeoVim is a fork of vim that evolved into its own thing, but maybe you already knew that.

In this very short post, I'm going to help you configure your NeoVim installation on Windows to use NERDTree and vim-airline.

Starting from ready-made init.vim file

Download Lefticus's vim-config files (including the autoload directory) to your nvim configuration directory.

On Windows 10 it will be located at C:\Users\<USER>\AppData\Local\nvim, where <USER> is your user handle. Maybe you'll need to create the nvim folder.

Lefticus's config files already include vim-airline. Let's add NERDTree. Locate in the init.vim file the section where plugins are added. Add the line Plug 'preservim/nerdtree' to this section. You may end with something like this.

Section of the init.vim file with Plug commands

Installing the plugins

Launching neovim after adding the files may show some errors. These errors will be corrected after downloading the plugins.

Enter command mode (press :) and run the command PlugInstall. Ex: :PlugInstall. Another tab will open with the downloading and installation progress.

If at any moment you need to update the plugins, run :PlugUpdate. And if any plugin is broken (for example, when I changed the path to NERDTree), you may be prompted to run :PlugClean.

Configuring Airline to use a Nerd Font with Powerlines

Firstly, if you don't have a Nerd Font, you can install Cascadia Code.

Better yet, if you're using the vim-devicons plugin, use the patched version at Nerd Fonts that include the icons. The rest of the post follows as equal.

The next step is to add a line to your init.vim file configuring GUI Font to a font with powerlines. See the example below, where I configure neovim to use Cascadia Mono PL with size 12:

set guifont=Cascadia\ Mono\ PL:h12
Enter fullscreen mode Exit fullscreen mode

Mapping an shortcut for toggling NERDTree

Add the following line to your init.vim file.

map <C-o> :NERDTreeToggle<CR>
Enter fullscreen mode Exit fullscreen mode

This will set Ctrl+o to run the command :NERDTreeToggle.

Adjusting tabs to spaces

These lines will adjust tabs to 4 charactes wide. (Extracted from StackOverflow).

set tabstop=4
set softtabstop=0 noexpandtab
set shiftwidth=4
Enter fullscreen mode Exit fullscreen mode

Being a heretic and using the mouse

If you really want to use the mouse with neovim, add set mouse=a to your init.vim. a stands for "all modes".

Beware! You will attract strange looks from fellow workers using a mouse with neovim.

The final look

NeoVim screen showing what you can achieve using the plugins and config files mentioned in the post

References

Latest comments (0)