How to Install Neovim on Ubuntu 22.04 LTS

Neovim is an extendable Vim-based text editor that is free and open-source. It’s a hyperextensible platform that seeks to maximize usability with extensibility in mind; it also simplifies maintenance by encouraging contributions from others who work on this project! Neovim also is extended using APIs and plugins, among a few features.

Some of the ideals of Neovim compared to VIM:

  • Simplify maintenance and encourage contributions
  • Split the work between multiple developers
  • Enable the implementation of new/modern user interfaces without any modifications to the core source
  • Improve extensibility with a new plugin architecture

More information about Neovim can be found in the Vision section on Neovim’s website.

In the following tutorial, you will learn how to install the Neovim on Ubuntu 22.04 LTS Jammy Jellyfish using various methods such as Ubuntu’s default repository, the Neovim team LaunchPAD PPA, or third party managers such as Snapcraft or Flatpak using the command line terminal.

Update Ubuntu

Before proceeding, ensure your Ubuntu system is up-to-date using the following command.

sudo apt update && sudo apt upgrade -y

Install Neovim – APT with Ubuntu Method

Most users’ first and easiest method is to install NeoVim using the standard Jammy Jellyfish repository.

Install Neovim using the following command.

sudo apt install neovim -y

For users who want a more updated version, I recommend using one of the PPA versions created by the NeoVim team.

Install Neovim – APT with PPA Method

Often Ubuntu LTS releases can lag behind new releases of software in the effort to keep systems stable and only release security patches. Given in time, new software versions are available that can contain new features and general performance improvements. You may want to install a more recent version.

Luckily, the “Neovim PPA” team has a PPA that can achieve this with a stable or unstable version to select from.

Before proceeding, run the following command to ensure the following dependencies are installed.

sudo apt install software-properties-common -y

Next, import the PPA using the following command. Please note that only one version can be installed simultaneously, so if you import both, then unstable will be installed as it is the newest version.

Import Stable Neovim PPA

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

Import Unstable Neovim PPA

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

Run an APT update to sync the changes.

sudo apt-get update

Install NeoVim

With the PPA imported, install the editor.

sudo apt install neovim -y

Alternatively, you can use the upgrade command if you have the editor installed already, but I would always advise running the install command.

Install Neovim – Snapcraft Method

The second option is to install with Snap. The Snapcraft package manager should be installed on your Ubuntu desktop unless you have removed it previously.

Overall, Snaps are not as popular as Flatpak, given that it is made by the same owners behind Ubuntu and its history and forcing users to adapt to it. Given that Flatpak has a more significant adoption rate than other Linux distributions, the maintainers of packages are quicker to update Flatpak versions than Snapcraft versions; this is again dependent on who is maintaining it.

For users that removed snapd, re-run the following command:

sudo apt install snapd -y

Once installed, you will need to restart your system, or else the icons may not appear; if you skip a repeat and notice any issues, reboot.

reboot

Snap installed? Skip the following few lines and proceed straight to the installation with Snap

Next, some packages come in classic, so you need to create a symlink to enable classic snap support, so it is best to run this command for the best snap compatibility.

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

Install the core files to avoid conflicting issues.

sudo snap install core

Next, install the snap version of the software.

sudo snap install nvim --classic

Install Neovim – Flatpak Method

The last option is to use the Flatpak package manager, which is not installed on Ubuntu distributions, given Snap, which is Flatpak’s rival, is owned by Canonical and Ubuntu. However, Flatpak is still available to install from Ubuntu’s default repository.

The extra benefit of using Flatpak installations is that you will always have the most up-to-date version compared to the Ubuntu default repository, which focuses on stability with older versions that only see updates for security issues or serve bugs unless the Flatpak maintainer goes AWOL, but this is a risk with using any third-party PPA or package manager.

First, install the Flatpak manager; this can be skipped if you already have it installed.

sudo apt install flatpak -y

Next, you need to enable Flatpack using the following command in your terminal:

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

Ideally, you should reboot at this stage; if you skip this and notice icons not appearing, the reboot will generate the paths required for the future.

reboot

Now run the installation using the following flatpak command.

flatpak install flathub io.neovim.nvim -y

How to Launch Neovim

Launching the application can be done in a few different methods, while in your terminal, you can use the following command.

neovim

Alternatively, you can launch it from the terminal and send it to the background to keep using the terminal instance using the following.

neovim &

Snapcraft users can launch from the terminal using the following command.

sudo snap run neovim

Lastly, Flatpak users run the following terminal command.

flatpak run io.neovim.nvim

For desktop users, find the icon application and possibly add it to your favorites.

The location path can be found in Activities > Show Applications > Neovim

Example:

How to Install Neovim Editor on Ubuntu 22.04 LTS

Once open, you will see the default landing screen. For users new to VIM and Neovim, I would strongly recommend checking out Neovim’s documentation which is quite extensive and without being overly complicated.

Example:

How to Install Neovim Editor on Ubuntu 22.04 LTS

How to Update/Upgrade Neovim

Updates should appear in notifications, but if these fail to show sometimes, it is recommended to check using the terminal regardless use one of the following commands to check for updates.

APT Method

sudo apt update

Flatpak Method

flatpak update

Snap Method

sudo snap refresh

How to Remove (Uninstall) Neovim

Use one of the following commands to suit the original installation method for users who no longer require the application.

APT Remove Method

sudo apt autoremove neovim* --purge -y

Note that autoremove will also delete any unused packages from Neovim and any other leftovers from previous applications. Most times, this is safe to do and should be done to keep your system from being bloated.

Lastly, users who installed Neovim using one of the two listed PPAs. Remove the PPA using the following command with the –remove flag added to the original command.

Remove Neovim Stable PPA

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

Remove Neovim Unstable PPA

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

Flatpak Remove Method

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

Next, run the following command for any leftover clean-ups required, similar to the autoremove command described for the apt remove example command.

flatpak remove --unused

Snapcraft Remove Method

sudo snap remove --purge neovim

Comments and Conclusion

In the tutorial, you have learned various ways to install Neovim on Ubuntu 22.04 LTS Jammy Jellyfish.

Neovim is Vim. It’s the next step, the logical continuation of a great editor. If you’re looking for an editor that can do more than edit text files, Neovim is your best bet.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!