Install Neovim on Ubuntu 22.04

Install Neovim on Ubuntu 22.04

Neovim is a text editor for creating and editing text files via command line. Neovim is a fork of Vim text editor. Development of Neovim was started from a copy of Vim repository. Neovim retains the features of Vim, and also introduces new features. Neovim is focused to improve plugin architecture, performance, and user experience.

This tutorial demonstrates how to install Vim on Ubuntu 22.04.

Install Neovim

Update the package lists:

sudo apt update

Install Neovim by running the following command:

sudo apt install -y neovim

Once the installation is complete, you can check Neovim version:

nvim --version

Testing Neovim

To create a new file or edit an existing file, run nvim command and provide filename as argument:

nvim test.txt

Run the command as a superuser if missing required permissions.

sudo nvim /var/log/dpkg.log

The file is opened in read-only mode. To edit the file, switch to insertion mode by pressing the letter i. When finished editing the file, exit the insertion mode by pressing ESC key. To save the file and exit Neovim, type :wq command and press the Enter key. Type :q! command, to exit without saving.

Editing file with Neovim on Ubuntu

Uninstall Neovim

To completely remove Neovim and related dependencies, run the following command:

sudo apt purge --autoremove -y neovim

You can also remove Neovim data:

rm -rf ~/.local/share/nvim
sudo rm -rf /root/.local/share/nvim

Leave a Comment

Cancel reply

Your email address will not be published.