Open In App

How to Install and Use Neovim in Linux

Last Updated : 02 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Neovim, short for Neo-Vi Improved, is a fork of Vim (Vi-Improved) with the primary goal of enhancing the codebase. This improvement facilitates the easier implementation of APIs, enhances the user experience, and supports plugin development.

Installation of Neovim in Linux Distribution

Neovim is typically included in the repositories of most Linux distributions due to its popularity. Consequently, there’s a strong likelihood that you can conveniently acquire it using your distribution’s package manager. To obtain Neovim, simply follow the specific commands tailored to your distribution.

1. For Ubuntu and its derivatives you can use the apt package manager. The same command will also apply to Debian systems.

$ sudo apt install neovim

2. On Arch-based distributions you can use the pacman package manager.

$ sudo pacman -S neovim

3. For RHEL/CentOS you can use the yum package manager.

$ yum install -y neovim python3-neovim

4. On Fedora you can use the dnf package manager.

$ sudo dnf install -y neovim python3-neovim

5. In the case of Gentoo-based Linux distributions, you can utilize the provided command:

$ emerge -a app-editors/neovim

If the Neovim package is not available in your distribution’s repositories, an alternative is to opt for the Flatpak version. To install the Flatpak version of neovim, follow the steps outlined below:

Step 1: Navigate to https://flatpak.org/setup/, where you can select your specific distribution and proceed to follow the provided installation instructions for Flatpak.

Step 2: After completing the setup, you can utilize the provided command to fetch the Flatpak version of neovim.

$ flatpak install flathub io.neovim.nvim

Now you’ve successfully downloaded Neovim.

Usage

If you’ve acquired neovim from your distribution’s repositories, you can initiate it using the “nvim” command. However, if you’ve opted for the Flatpak version, you’ll need to use the “Flatpak run io.neovim.nvim” command to launch it. This should open a new screen in your terminal.

nvim

The main screen of Neovim

Note : It’s important to acknowledge that the commands you’ve utilized for running Vim are equally applicable to Neovim, as Neovim is essentially a fork of Vim.

If you prefer not to use the lengthy command for the Flatpak version, you can execute these commands to establish “nvim” as your default alias for the Flatpak version.

$ echo "alias nvim=\"flatpak run io.neovim.nvim\"" >> .bashrc
$ source .bashrc

You may replace .bashrc if you are using another shell such as .zshrc for zsh.

Migrating from Vim

If you intend to transition your current Vim configuration to Neovim, you can easily do so by copying your ~/.vimrc file to ~/.config/vim/init.vim. Additionally, if necessary, transfer the contents of ~/.vim/autoload/ to ~/.local/share/nvim/site/autoload/.

Frequently Asked Questions

1. Which is better Vim or Neovim?

The choice between the two actually depends on your specific use case, and both options have their merits. Neovim, in particular, incorporates numerous optimizations, partly due to the fact that Vim’s original codebase is somewhat convoluted, which prompted the creation of Neovim in the first place. It’s worth noting that Neovim and Vim are mutually compatible.

2. Is it possible to utilize my current Vim configuration with Neovim?

Indeed, you have the option to employ your current Vim configurations with Neovim. The necessary instructions are already outlined in this article for your convenience. Alternatively, you can consult the official Neovim documentation on GitHub for further guidance.

3. Where do I get good Neovim Plugins?

The most comprehensive repository of Neovim plugins can be found at rockerBOO/awesome-neovim on GitHub.

4. Is Windows Supported

Indeed, Neovim has supported the Windows operating system since its 0.2 release. You can find installation instructions on the respective page. However, it’s important to note that because of a shortage of maintainers, relying on the corresponding dependencies and using Neovim on Windows is not recommended.

5. Why Neovim is faster than Vim?

Vim’s plugin API is known for its limitations and complexity. In contrast, NeoVim offers a more streamlined and improved plugin architecture. Furthermore, NeoVim boasts a wider range of robust plugins that, regrettably, are not compatible with Vim.

Conclusion

In this article, we’ve successfully installed Neovim, an evolution of Vim, by following the installation guidelines for various Linux distributions. Neovim is a powerful tool for efficient file editing on the fly. With mastery, it can even serve as a suitable replacement for your default Integrated Development Environment (IDE). If you’ve opted for the Flatpak version, consider customizing its alias to enhance your overall user experience.

With its extensibility and a thriving ecosystem of plugins, Neovim empowers you to tailor your text editing environment to suit your specific needs.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads