How to Install Neovim v0.9+ in WSL
Introduction:
Want a powerful default text editor for your WSL environment? Well, Neovim comes as one of the most preferable text/code editors to work with different types of files in your Linux environment. Neovim, a modern text editor inspired by the classic Vim, has gained popularity among developers and writers alike for its power and flexibility. It is extremely lightweight, and fast and has many keybindings and plugin support to take your productivity to the next level. While it takes time and effort to configure Neovim properly based on your preferences, it is still a valuable asset to developers, and programmers because the subsequent benefits far outweigh this investment.
Summary of The Content Prior to Reading The Article
Neovim is a lightweight and powerful text editor for your WSL environment, offering extensive customization options and a rich plugin ecosystem. This article guides you through installation on various Linux distributions, including manual methods and using PPAs for Ubuntu. While setting up Neovim may require effort, its flexibility and performance benefits make it a valuable tool for developers. Customize your experience further with themes and plugins, leveraging the extensive resources available through the Neovim community.
Prerequisites:
Make sure you have Windows 10 or higher with WSL2 already installed.
Basic familiarity with the command line interface.
Installation :
If you are in a Debian-based system, then the following code should work -
sudo apt update -y && sudo apt full-upgrade -y
sudo snap install neovim
Warning: snap
packages are designed to be isolated and self-contained which can limit the level of customization you need. Also, snap packages consume more disk space compared to other installation methods, which can lead to longer start-up times. so installation with the snap package managers is not preferable. It's better to follow the manual method according to the official GitHub page of Neovim.
Note : apt
repositories do not contain the latest stable version(v0.9.1) of Neovim. Using an older version from apt
or snap
could potentially lead to compatibility issues with certain plugins.
If you are using openSUSE-Tumbleweed as your WSL, then you won't need to worry much just run the following command and the bleeding-edge stable Neovim will be installed in your system -
sudo zypper dup
sudo zypper install neovim
If you are using ArchWSL, the following code should work properly -
sudo pacman -Syu
sudo pacman -S neovim
Manual Method:
We are going to install the latest stable release of Neovim with the tarball. The tarball installation method is supported in most distributions.
Go to the Nvim release build webpage, scroll down and install the nvim-linux64.tar.gz from assets.
By default, it will be downloaded in the 'Downloads' location of your local disk. You may also need to check that. Open your WSL(Debian or Ubuntu in my case) terminal and run the following code. Replace the
/path/to/your/location
with the actual location of the downloaded tarball.You may need to use sudo before that. If there is no such directory like
~/.local/bin
, then simply create it and add it to the environment variable before moving thetar
to the directory. Or, if you want you can choose any other existing directory in your Linux distro whose path is already added to the environment variable.Go, to the directory(
~/.local/bin
in my case), and run the following command.tar xzvf nvim-linux64.tar.gz
This will unpack the tarball. Now if you run
ls
in your terminal, you should see Neovim has been built.
Now you can delete the tarball and the Zone.Identifier
file.
4. Run ./nvim-linux64/bin/nvim
to see Neovim opening successfully.
Finally, we will add a symbolic link to Neovim so that we can open it in the terminal from any directory. The process is again easy. Run -
ln -s ./nvim-linux64/bin/nvim ./nvim
From now you will be able to open from anywhere just by running nvim
in the terminal.
Update:
Installing Neovim by download(tarball) from the latest release can seem tedious because we can't just simply update it to newer stable versions over time.
The good news here is that Neovim has been added to a "Personal Package Archive" (PPA). This allows you to install it with apt-get
. Follow the links to the PPAs to see which versions of Ubuntu are currently available via the PPA. Choose stable or unstable
To be able to use add-apt-repository you may need to install software-properties-common
sudo apt-get install software-properties-common
Important Note:
The Neovim team does not maintain the PPA packages. For problems, contact
So, in Ubuntu now we can do this instead to install latest stable version -
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt-get update
sudo apt-get install neovim
Customization :
Remember, this is just the basic setup. For Neovim to look and work like your favorite IDE, you need to do a lot of customizations. Such works will be different based on the user's needs and preferences, so they can't be described in a single Blog post.
However, some information can be provided.
For UI themes & more automated customization with autocompletion, users can refer to preconfigured distributions, such as - NVChad, LunarVim, or maybe my own preconfigured distribution which I call Efficienvim; or any other distro out there.
Required plugins can be installed using
Vim-Plug
,Lazy.nvim
,Packer
or any other plugin manager for NeoVim.The configuration codebase must be entirely in lua, vim or fennel. It can't be both.
For additional resources, you can follow the Official Neovim Documentation.
Conclusion :
Incorporating Neovim into your WSL environment is a valuable step toward optimizing your development and writing experiences. Despite the initial setup, the rewards are plentiful. By seamlessly integrating Neovim into Windows through WSL, you bridge the gap between platforms and create a unified work environment. This approach empowers you to customize Neovim to your preferences, harnessing its powerful plugin ecosystem for enhanced productivity and creativity.
If anyone finds this Blog helpful, please comment below! Any suggestions or improvements will be cordially appreciated.
Subscribe to my newsletter
Read articles from Debajyati Dey directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Debajyati Dey
Debajyati Dey
Linux Enthusiast, Terminal Nerd, interested in open source, web dev, Neovim BTW