I really like the Vim editor and I also want to use it for programming. However, doing so with the original Vim is quite complicated. So I took a closer look at NeoVim. A more modern fork of Vim. I just looked up the fundamental differences to see which one I need to use now, or whether I can simply keep using “both.” Spoiler alert: I can simply keep using both.

And I will try to build a development environment in Rust that is easy to follow, and of course I will also publish the how-to for it here.

FeatureVimNeovim
Project philosophyStability, backward compatibility; shaped by a single lead developer (Bram Moolenaar, † 2023)Community-driven, rapid iteration, focus on modernization and extensibility
Configuration languageVimscript (VimL), plus Vim9script for new pluginsLua (native), Vimscript is still supported
LSP support (code completion, error checking)Not built in; requires plugins such as coc.nvim or vim-lspNatively built in (vim.lsp)
Asynchronous processingHistorically limited; plugins can blockNative via libuv; background processes without blocking
Plugin languageVimscript, Python, Ruby (often with compatibility problems)Lua, Vimscript; remote plugins via msgpack-RPC in any language
Availability on serversStandard on practically every Linux/Unix system; essential for SSH workflowsRarely preinstalled; often has to be installed first
Configuration directory~/.vim/ (historical, hardcoded)~/.config/nvim/ (follows the XDG standard)

The Most Important Practical Consequence

The choice depends heavily on my work environment:

  • If I work a lot on remote servers (SSH): Vim is the safe bet, because it is preinstalled almost everywhere
  • If I want a modern, IDE-like experience locally with plugins and LSP: Neovim offers the more powerful and more modern foundation

Parallel Installation - Yes!

Easily doable. Vim and Neovim are completely independent programs with different binary names (vim vs. nvim), separate configuration directories, and their own plugin folders. They do not interfere with each other.

Separate Configurations

VimNeovim
Configuration file~/.vimrc~/.config/nvim/init.vim or init.lua
Plugin directory~/.vim/~/.local/share/nvim/
Plugin manager (examples)vim-plug, Vundlelazy.nvim, packer.nvim

Since both use completely separate paths, I can have different plugins, themes, and settings in each without any conflicts arising.

Possible Overlap

There is one small detail: Some distributions offer a package named vim that is actually a symlink to neovim (or vice versa). However, this is rare and only the case on systems deliberately configured that way. Normally the following applies:

  • vim starts Vim
  • nvim starts Neovim

I can check this with which vim and which nvim.

Practical Tip: Default Editor

If I use both in parallel, it is worth setting Neovim as the default editor (e.g., via $EDITOR or alternatives) and keeping Vim as a fallback for servers/SSH. That way I have the modern environment locally and still always have a working editor on servers.

Super Flexible as an Alias

If you frequently switch between the two, you can create aliases in your ~/.bashrc. For example, on Debian/Ubuntu:

alias vim='nvim'
alias vim-old='/usr/bin/vim.basic'

On Arch and Manjaro, the alias for the original Vim would simply be alias vim-old='vim', because there vim still points to the original Vim.

Permanent - Debian & Ubuntu

For Ubuntu and Debian, you use update-alternatives to register Neovim as the system-wide default.

#### Register Neovim as an alternative for vi, vim, view, and vimdiff
sudo update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 60
sudo update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 60
sudo update-alternatives --install /usr/bin/view view /usr/bin/nvim 60
sudo update-alternatives --install /usr/bin/vimdiff vimdiff /usr/bin/nvim 60

The 60 at the end is the priority. Since Neovim is usually installed with a lower priority than Vim, this command ensures that vim and vi point to nvim.

To check whether it worked:

which vim
#### should output /usr/bin/nvim

If you want to change the assignment again later, you can run sudo update-alternatives --config vim and select interactively.

On Ubuntu, there is also the command sudo select-editor, which shows you a list of available editors and lets you choose. This is the easiest way if you do not want to manually edit configuration files.

Permanent - Arch & Manjaro

For Manjaro and Arch Linux, you instead set the environment variables. This is also the cleaner way, because it works independently of the distribution.

#### System-wide for all users
sudo tee -a /etc/environment <<EOF
EDITOR=nvim
VISUAL=nvim
EOF

The variables become active for all users at the next login. One advantage: Programs that access $EDITOR or $VISUAL then automatically use Neovim.

As the sudo Editor

A note for sudo: If you run sudo visudo or something similar, the environment variables from /etc/environment are not adopted by default, because sudo sanitizes the environment for security reasons. In that case, you can use sudo -E visudo or add the variable in the sudoers file with Defaults env_keep += "EDITOR VISUAL".

sudo -E visudo - temporary

The -E parameter (for --preserve-env) causes sudo to completely preserve the environment for that one command. So you would always have to type sudo -E visudo.

That is impractical if you need it often. The entry in /etc/sudoers is the permanent solution so that you can simply use sudo visudo and still get Neovim.

sudoers - permanent

You enter the line Defaults env_keep += "EDITOR VISUAL" in the file /etc/sudoers. You never do this directly, but always via the command sudo visudo. The tool checks the syntax before the change is saved, thus preventing you from wrecking your system.

When you run sudo visudo, /etc/sudoers opens in an editor. You look for the line that begins with Defaults and add your line below it or at the end of the Defaults section.

An excerpt from the file then looks like this:

## Override built-in defaults
Defaults    env_reset
Defaults    env_keep += "EDITOR VISUAL"

The line Defaults env_reset is usually already present. It ensures that sudo uses a clean environment. With Defaults env_keep += "EDITOR VISUAL" you tell sudo that it should keep the variables EDITOR and VISUAL from your environment.

Why This Is Necessary

By default, sudo sanitizes the environment. So if you have set EDITOR=nvim and then run sudo visudo, sudo no longer sees this variable. It then falls back to the default editor, often vi or nano.

With the env_keep entry, your EDITOR variable survives the sudo call, and visudo opens with Neovim (or whatever you have set).

Sources