Here’s a quick post from me today.
I recently switched to Neovim through the installation of LunarVim. I really like the feel of it a whole lot, and as an Awesome WM user, I can appreciate how the config is written in Lua. Besides that, I know that the usual command to enter Neovim is nvim.
It can be annoying if you’re a creature of habit such as myself and instinctively type vim whenever you want to open up a text file. You then realize it opened up in regular Vim instead, or maybe you removed Vim entirely and get an error because it’s not installed. Not the worst problem in the world, but it’s still inconvenient.
Thankfully, there’s a quick and easy fix thanks to the .bashrc (or any other similar file such as .zshrc). We’re going to use the power of the alias to make this easier.
Set Up “vim” to open Neovim or LunarVim
Start by opening up your .bashrc or .zshrc. On most typical Linux installs, this is going to likely be the former instead of the latter.
Now find a place in your config file to put in this following line:
alias vim='nvim'
If you’re like me and happen to be using LunarVim, on the other hand, the line would look more like this (assuming you have LunarVim installed already):
alias vim='/home/NAME/.local/bin/lvim'
(Obviously, you’ll want to switch the “NAME” with whatever your user is for your Linux system.)

Once you add either line, save the file and quit.
Next, you’ll want to either close the terminal entirely and open up a fresh one. Alternatively, in case you don’t feel like closing the terminal window, you could type bash or zsh to reload the shell and see the changes take effect. Don’t skip either step or you won’t see a difference.
That Was It, Really!
Not too hard, right?
If everything worked, typing vim into a terminal should now open up Neovim for the former or LunarVim for the latter. This also carries over to opening up any files within the terminal rather than only using the command alone.
Anyway, I just switched a few days ago to LunarVim after having used SpaceVim for a while. I might discuss my experience with both of them in a future post if there’s enough interest on the subject, although I usually feel like a greenhorn when it comes to using and configuring Vim in the first place.

One response to “How to Have “vim” Open Neovim or LunarVim”
[…] LazyVim installation, which is a Neovim distribution, was broken in terms of actually displaying proper colors and contrast. At times, it would change […]
LikeLike