Setting up Neovim in WSL
In my personal time, I develop on WSL because I only own Windows laptops. I’m a dirty casual, I know. I’ve been learning how to use Neovim recently as a potential replacement to VSCode. The setup has been quite painful, so I thought I might document how I did it in this article.
I assume you already have WSL installed.
Vim is a text editor that lives in your terminal. You’ve probably entered vim by accident at some point if you ran
git commit
without-m
.
Installing Neovim through Homebrew
Unfortunately, sudo apt-get install neovim
installs an outdated version of Neovim at the time of writing. Instead, I decided to install Neovim through Homebrew. Run the following command to install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
IMPORTANT: Once the installation completes, it’ll tell you to run a few more commands in the output — don’t skip this! These commands will add brew
to your $PATH
. Otherwise, you might get a Command not found…
error.
Now we can install nvim
:
brew install neovim
Great, now we have Neovim in WSL. Test it out:
nvim
You can exit Neovim by either typing :q!
and hitting Enter, or by pressing Ctrl+z
.
Installing a Nerd Font
We need to use a Nerd Font as our WSL terminal font. Otherwise, certain icons in Neovim will just look like: ▯. In my case, I downloaded the JetBrainsMono Nerd Font (download here). Once the download was completed, I unzipped the directory, selected all the fonts, and right-clicked my selection. This lets you choose the option to “Install all” the fonts.
To use the Nerd Font in our Windows Terminal:
- Open up Settings
ctrl ,
- Open the tray by clicking the three-lines icon on the top left
- Click Ubuntu under Profiles to open its profile settings
- Scroll down to Additional Settings and click Appearance
- Change Font face to JetBrainsMono Nerd Font