How to Install Neovim on Ubuntu 24.04, 22.04, or 20.04

Experience and add new features without losing the core benefits Vim users love. Neovim is designed for extensibility and usability, making it a top choice for developers, writers, and anyone working with text. Unlike traditional text editors, Neovim integrates smoothly with modern development tools and workflows, offering a powerful coding, configuration, and customization platform. Its lightweight design and compatibility with Vim plugins ensure a smooth transition, allowing users to enjoy its improved interface and features immediately.

Here’s why Neovim has quickly become a favorite among tech enthusiasts:

  • Efficient Editing: Powerful text manipulation capabilities that speed up coding and writing.
  • Highly Customizable: Extensive configuration options let users tailor the editor to their preferences.
  • Plugin Ecosystem: Access a wide range of plugins for added functionality, from autocompletion to Git integration.
  • Asynchronous I/O Support: Non-blocking UI operations for a smoother workflow.
  • Embedded Terminal: Run shell commands directly within the editor.
  • Improved GUI Support: Works with various graphical interfaces, enhancing usability.
  • Open Source: Backed by a vibrant community, ensuring continuous development and support.

Now, let’s dive into how to install Neovim on your Ubuntu system.

Update Ubuntu Before Neovim Installation

Before installing, updating your Ubuntu system to ensure optimal performance and compatibility is crucial. To update your system, execute the following command in the terminal:

sudo apt update && sudo apt upgrade

This command updates your package list and installs any available updates.

Install Neovim via APT, PPA, Snap, or Flatpak with Flathub

Method 1: Install Neovim with Ubuntu Repository

For many users, the most straightforward and convenient method to install Neovim is through the standard repository. To install this version, run the following command:

sudo apt install neovim

Please note that this method installs the version of Neovim available in the official Ubuntu repository, which may not be the most recent version. For users seeking the latest updates and features, consider using one of the Neovim team’s PPA versions as an alternative installation method.

Method 2: Install Neovim with Neovim Team PPA

The second method for installation of Neovim is to import either the stable or unstable (nightly) version directly from the Neovim LaunchPAD PPA. Use one of the following commands based on the version you want to install:

Import Neovim stable PPA:

sudo add-apt-repository ppa:neovim-ppa/stable -y

Import Neovim unstable PPA:

sudo add-apt-repository ppa:neovim-ppa/unstable -y

Next, update your package index to include the newly added PPA:

sudo apt update

Now, you can proceed to install Neovim using the following command:

sudo apt install neovim

Once completed, the Neovim Team PPA will have installed Neovim on your system. Verify the installation of the PPA version by running the following command:

apt-cache policy neovim

Example output shows the Neovim PPA installed on Ubuntu, using the unstable version for this guide.

Method 3: Install Neovim with Snapcraft

The Snapcraft package manager can be your third option when installing Neovim on Ubuntu. Your Ubuntu desktop should already have Snap installed unless you removed it.

Although Snapcraft is not as popular as Flatpak, it comes from the same developers behind Ubuntu. Flatpak enjoys broader adoption across different Linux distributions, leading package maintainers to update Flatpak versions faster than Snapcraft versions. However, update speed ultimately relies on the specific package maintainer.

If you’ve uninstalled snapd from your system, use the following command to reinstall it:

sudo apt install snapd

Some packages require classic snap support. To enable this, create a symlink with the following command for optimal snap compatibility:

sudo ln -s /var/lib/snapd/snap /snap

Install the core files to prevent conflicts:

sudo snap install core

Finally, install the snap version of Neovim:

sudo snap install nvim --classic

After completing these steps, you have successfully installed Neovim on your system with the Snapcraft package manager.

Method 4: Install Neovim with Flatpak via Flathub

An alternative method for installing Neovim is Flatpak, a versatile package management system that provides a sandboxed application environment. To install Neovim via Flatpak, you must add the Flathub repository containing the Neovim package.

Note: If Flatpak isn’t installed on your system, please refer to How to Install Flatpak on Ubuntu with the Flatpak Team Official LaunchPAD PPA. This guide offers instructions for obtaining the latest supported version using the Flatpak Team Official LaunchPAD PPA.

Begin by opening the terminal and entering the following command to integrate the Flathub repository:

sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Now, run the Neovim installation using the following flatpak command:

flatpak install flathub io.neovim.nvim

Upon completing these steps, you have installed Neovim on your system with Flatpak and Flathub package manager.

Launch Neovim via CLI or GUI

There are several methods for launching Neovim, depending on your installation method and preference.

CLI Methods to Launch Neovim

Standard Installation: If you installed Neovim using the default repository, PPA, or built it from source, launch Neovim by entering the following command in your terminal:

neovim

Snapcraft: If you installed Neovim using Snapcraft, launch it from the terminal with the following command:

sudo snap run neovim

Flatpak: If you installed Neovim using Flatpak, run the following command in the terminal:

flatpak run io.neovim.nvim

GUI Method to Launch Neovim

Desktop Application: For desktop users, locate the Neovim application icon by navigating to Activities > Show Applications > Neovim. You can also add Neovim to your favorites for easy access.

Additional Commands For Neovim

Update Neovim

To ensure that you are using the latest version of Neovim, it’s crucial to check for updates regularly. While update notifications may appear automatically, verifying updates’ availability manually is good practice. Depending on your installation method, use one of the following commands in the terminal to check and apply updates for Neovim:

APT Neovim Update Method

To update Neovim installed via the APT method, first update the package list and then upgrade the packages:

sudo apt update && sudo apt upgrade

Flatpak Neovim Update Method

To update Neovim installed via Flatpak, execute the following command:

flatpak update

Snap Neovim Update Method for Ubuntu

To update Neovim installed via Snap, run the following command:

sudo snap refresh

By regularly updating Neovim, you can benefit from the latest features, improvements, and bug fixes, ensuring a smooth and efficient experience.

Remove Neovim

If you no longer need Neovim on your system, follow the instructions below to uninstall it, depending on the original installation method. Additionally, these steps will help you clean up any leftover files and data to maintain a clutter-free system.

APT Neovim Remove Method

To uninstall Neovim installed via the APT method, execute the following command:

sudo apt remove neovim

If you installed Neovim using one of the PPAs, remove them with these commands:

Remove Neovim Stable PPA:

sudo add-apt-repository --remove ppa:neovim-ppa/stable -y

Remove Neovim Unstable PPA:

sudo add-apt-repository --remove ppa:neovim-ppa/unstable -y

Flatpak Neovim Remove Method

To uninstall Neovim installed via Flatpak, run the following command:

flatpak remove  --delete-data io.neovim.nvim -y

Snap Neovim Remove Method

To uninstall Neovim installed via Snapcraft, use the following command:

sudo snap remove neovim

Conclusion

In wrapping up our guide, we’ve covered the essentials of installing Neovim on Ubuntu, tailored advice for first-timers, and customized and optimized it to elevate your coding journey. The key takeaway? Dive into Neovim with curiosity and openness to tweak it to your liking.

Useful Links

Here are some valuable links related to installing Neovim:

  • Neovim GitHub Repository: Explore the official Neovim GitHub repository for access to the source code, contribution guidelines, and issue tracking.
  • Neovim Documentation: Consult the comprehensive Neovim documentation for detailed installation, configuration, and usage guides.
  • Neovim Roadmap: Check out the Neovim roadmap to stay informed about upcoming features, planned improvements, and future releases.
Joshua James
Follow me
Latest posts by Joshua James (see all)