How to Install Neovim on Linux Mint 21 LTS


Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is an almost entirely compatible version of the Unix editor Vi. Many new features have been added: multi-level undo, syntax highlighting, command line history, online help, filename completion, block operations, foldings, Unicode support, etc.

Neovim is a project that seeks to aggressively refactor Vim source code to provide feature parity with Vim and additional wide-ranging capabilities for plugins and scripting languages that current versions of Vim lack. This will include a better plugin architecture, improved documentation and tutorials, a logo, and website rebranding. Neovim has an exemplary default configuration for modern systems out of the box. However, it retains much of the flexibility and configurability that made Vim so famous in the first place; experienced users can still fine-tune Neovim to their particular workflow. Also, plugins can be written in any programming language and extended using arbitrary APIs, making Neovim an excellent platform for anything from quick notes to full-scale project development.

In the following tutorial, you will learn how to install the Neovim on Linux Mint 21 LTS release series using various methods such as the default repository, the Neovim team LaunchPAD PPA, or third-party manager Flatpak using the command line terminal.

Update Linux Mint

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

sudo apt update && sudo apt upgrade -y

Install Neovim – APT Default 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

Linux Mint LTS releases often lag behind new software releases to keep systems stable and only release security patches. New software versions can contain new features and general performance improvements, and 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.

See also
How to Install Linux Kernel 6.1 on Linux Mint 21 or 20

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

sudo apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https -y

Next, import the GPG key needed for all the repositories.

sudo gpg --no-default-keyring --keyring /usr/share/keyrings/neovim.gpg --keyserver keyserver.ubuntu.com --recv-keys 9DBB0BE9366964F134855E2255F96FCF8231B6DD

If you have issues importing the GPG key from LaunchPAD, please see the end section on GPG troubleshooting at the end of the article.

Example output:

gpg: keybox '/usr/share/keyrings/neovim.gpg' created
gpg: key 55F96FCF8231B6DD: public key "Launchpad PPA for Neovim PPA Team" imported
gpg: Total number processed: 1
gpg:               imported: 1

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

Import Stable Neovim PPA

echo 'deb [signed-by=/usr/share/keyrings/neovim.gpg] https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu jammy main' | sudo tee -a /etc/apt/sources.list.d/neovim.list

Import Unstable Neovim PPA

echo 'deb [signed-by=/usr/share/keyrings/neovim.gpg] https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu jammy main' | sudo tee -a /etc/apt/sources.list.d/neovim.list

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 – Flatpak Method

The last option is to use the Flatpak package manager, installed on your Linux Mint desktop, as the alternative third-party package manager unless you have removed this.

The extra benefit of using Flatpak installations is that you will always have the most up-to-date version compared to the Linux Mint 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, re-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

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.

See also
How to Install Visual Studio Code on Linux Mint 21 or 20

The location path can be found in Taskbar > Activities > Neovim

Example:

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 Update/Upgrade Neovim

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

APT Method

sudo apt update

Flatpak Method

flatpak update

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 unused packages from Neovim and other leftovers from previous applications. This is usually safe and should be done to keep your system from bloating.

Lastly, users who installed Neovim using one of the two listed PPAs, use the following command to remove the repository. For users that are downgrading from unstable to stable, re-import the stable repository using the steps at the beginning.

sudo rm /etc/apt/sources.list.d/neovim.list

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

How to Fix Broken GPG Import

Users that have installed Linux Mint for the first time or have not imported a GPG key before using the command line terminal will often have issues importing GPG keys from LaunchPAD PPAs due to the directories not being created. This is an easy fix. Use the following command that will, in turn, generate the directories.

sudo gpg --list-keys

Example output:

As above, the necessary directories have been created. This can be skipped, and use the following GPG import command below. If you have any issues with directories missing for this and any other PPA GPG key in the future, just run the above command.

Comments and Conclusion

If you’re looking for an editor that is both powerful and extensible, Neovim may be the right choice for you. It has a large community of contributors constantly working to improve it, making it an excellent platform for your next project.

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

Leave a Comment

Share to...