Why use Vim instead of NeoVim? Is NeoVim similar to Vim? Should I replace Vim with NeoVim? What’s the difference between Vim and NeoVim?
If you’re wondering about any of the above questions, let’s resolve the confusion objectively. In this article, I’ll list the major difference that makes NeoVim and Vim different from each other.
NeoVim Is An Extension Of Vim
Where Vim (VI– IMproved) is a fork of Vi, NeoVim is a fork of Vim. That’s the beauty of free and open-source software. However, Vim is almost as old as Linux, and NeoVim is a new entrant compared to that.
Being derived from Vim, NeoVim expands on the core functionalities of Vim and also addresses some of the core issues with Vim.
Furthermore, NeoVim adds a lot of default configurations for which you might need additional effort to bring in Vim. For instance, mouse, autoread, and autoident are enabled by default in NeoVim.
Vim has a terminal-based shell environment for text editing tasks, with no graphical user interface (GUI). Whereas Neovim employs a powerful GUI architecture called Oni that provides modal editing without any need for a terminal user interface.
So, if you’re very much comfortable with a command line, Vim might feel natural or you can also bank on a feature-rich user interface of Vim’s refactored version Neovim.
XDG Base Directory
The XDG Base Directory is now a popular specification that major Linux users to define where configuration files should be looked for by defining one or more base directories relative to which files should be located.
For instance, the XDG_DATA_HOME environment variable defines the base directory relative to which user-specific data files should be stored, and XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be written.
Likewise, NeoVim follows XDG Base Directory Specification for placing its configuration files. However, Vim follows a hardcoded path for storing its plugins and configuration files.
For editing configs, Vim uses a .vimrc file whereas NeoVim uses $XDG_CONFIG_HOME/nvim/init.vim or ~/.config/nvim/init.vim. For storing configuration files, Vim uses .vim whereas NeoVim uses $XDG_CONFIG_HOME/nvim.
Though Vim and NeoVim provide additional functionality via Plugins, both follow different architectures of plugins. Vim’s plugin API is restrictive to Vim script (also called Vimscript or VimL) scripting language whereas along with Vimscript, NeoVim also allows using Lua programming language for plugin API.
In addition, NeoVim stands different from Vim in terms of executing plugin code. In Vim, you might have observed the UI freezes when any plugin’s code executes, this is because Vim runs it synchronously i.e. one by one. So you need to wait until each line gets executed.
Whereas, NeoVim has much easier plugin management with the help of numerous plugin managers. In terms of plugin start-up, NeoVim follows an asynchronous path where plugin code executes in parallel instead of line by line. So, you’ll find plugin initialization and execution much faster in NeoVim than in Vim.
Also, if you’re using remote plugins in NeoVim, it allows plugins to work without blocking the editor and keeping it stable by running them in separate processes.
LSP Support in NeoVim
Coming to the most important point for which you might choose NeoVim over Vim. This is because NeoVim has out-of-the-box support for JSON-RPC-based LSP (Language Server Protocol) while Vim doesn’t.
What is actually LSP support means is that you will by default find features that most programmers look for in any code editor such as code highlighting, syntax checking, and auto code completion. However, you can add these features in Vim also by installing third-party plugins externally.
Installation of NeoVim and Vim
We can’t ignore the installation factor while comparing NeoVim and Vim because the easy availability of the software does matter to a lot of people including myself.
So, being a classic and one of the oldest code editors, Vim is available by default in various Linux distributions. Even if not, you can install it on all Linux distributions from respective default repositories using the package manager, Flathub using Flatpak universal package manager, and Snap Store using Ubutnu’s default and universal package manager Snap.
Though you’ll not find NeoVim by default in any Linux distros, you still can get it easily from respective default repositories, Flathub, and Snap Store.
Install NeoVim on Linux
$ sudo apt install neovim [On Debian, Ubuntu and Mint] $ sudo yum install neovim [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] $ sudo emerge -a app-editors/neovim [On Gentoo Linux] $ sudo apk add neovim [On Alpine Linux] $ sudo pacman -S neovim [On Arch Linux] $ sudo zypper install neovim [On OpenSUSE]
Install Vim on Linux
$ sudo apt install vim [On Debian, Ubuntu and Mint] $ sudo yum install vim [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] $ sudo emerge -a app-editors/vim [On Gentoo Linux] $ sudo apk add vim [On Alpine Linux] $ sudo pacman -S vim [On Arch Linux] $ sudo zypper install vim [On OpenSUSE]
Whether you need any help regarding software usage or you’re finding any error in the software itself, a community of users and developers is where you mostly go. That is why a strong community is needed to thrive in the software ecosystem and keep sharing ideas and information.
Surprisingly, building a community-driven open-source project is one of the main objectives of NeoVim. A large community of developers maintains NeoVim and resolves bugs on GitHub.
While Vim is still mainly led by its founder Bram and has a limited user and developer bases that actually participate in the developer process and discussion that happens around the mailing list.
However, this cannot be ignored that with the entry of new competitors like NeoVim, Vim is also now trying to be more open and radical to introduce new features.
As we saw above, though Vim and NeoVim perform the same task, both differ from each other in many ways. Where Vim is a popularly established classic text editor, NeoVim aims to enhance the same by incorporating default features, LSP support, and following modern XDG base directory specs.
At last, the choice depends on your requirement and suitability. If you just need a text editor to modify files or write scripts on a server with no fancy stuff, not even a mouse, you can settle with Vim. Or, if you’re a programmer, you might go for NeoVim which provides a bundle of preconfigured features like code highlighting, syntax checking, and auto code completion.