So I'm trying to have nvim as my default editor in ranger and I'm about at wits end.

To do this according to their wiki, I just need to export EDITOR=nvim. But it just comes up with a nvim command not found error. See the seemingly insanity below:

[username@login001 clusterUtils]$ export EDITOR=nvim
[username@login001 clusterUtils]$ $EDITOR
bash: nvim: command not found
[username@login001 clusterUtils]$ nvim
YouCompleteMe unavailable: requires Vim compiled with Python (2.7.1+ or 3.4+) support.
Press ENTER or type command to continue
[username@login001 clusterUtils]$ echo $PATH
[username@login001 clusterUtils]$

As you can see, nvim is in my $PATH multiple times due to me having put it in .profile, .bash_profile, and .bashrc.

From above, you can see that when I just try to run $EDITOR, it comes up withbash: nvim: command not found.

However, if I try to open a text file through ranger, I get /bin/sh: nvim: command not found instead.

I know there are similar questions already posted, but none of their solutions helped me.

Edit: Something of note is that this work is being done on a cluster. So I don't have access to the root directory, only my home directory.

  • Adding it to your path and environment doesn’t make it installed. Is it?
    – Jeff Schaller
    Jul 28, 2018 at 1:19
  • What does which nvim show for the file path? Does setting EDITOR to the absolute path change anything? Does alias have anything?
    – ErikF
    Jul 28, 2018 at 1:26
  • @ErikF So running which nvim made me realize that I forgot to delete an alias for nvim that I had previously used in .bashrc that I had previously unaliased before. Unaliasing that, which nvim comes up with /usr/bin/which: no nvim in [proceeds to list $PATH]. Note that /home/username/bin/neovim/squashfv-root/usr/bin/nvim is in $PATH. After the unaliasing, nvim now doesn't work normally. Jul 28, 2018 at 1:31
  • @ErikF Doing export EDITOR=/home/username/bin/neovim/squashfv-root/usr/bin/nvim does work now! As does simply typing in /home/username/bin/neovim/squashfv-root/usr/bin/nvim. Any ideas as to why it isn't reading nvim from $PATH though? Jul 28, 2018 at 1:33
  • @JeffSchaller TBH, I don't really know what "installed" means other than there are binaries and they run successfully. The main issue right now is that bash doesn't seem to recognize that it has nvim in the $PATH. Is there something I'm missing to finish an install for a program? Jul 28, 2018 at 1:35

1 Answer 1


As pointed out in one of the comments, you seemed to have an alias set, that's why calling nvim directly on the shell was working.

After unaliasing it, you no longer can work with nvim. The issue you're having there seems to be that your $PATH is set incorrectly. You seem to have /home/username/bin/neovim/squashfs-root/usr/bin/nvim in your $PATH, but that's the full path to the nvim binary itself and not the path to the directory where it's located... $PATH only takes directories, not files itself. In this case, the system is trying to find it on /home/username/bin/neovim/squashfs-root/usr/bin/nvim/nvim which is clearly invalid...

You can correct that by addin /home/username/bin/neovim/squashfs-root/usr/bin instead of the incorrect path to your $PATH variable.

  • 1
    That's it. I added /home/username/bin/neovim/squashfs-root/usr/bin to $PATH and that worked. I was working under the Windows logic of PATH environment variables where you can point to a specific file, not just a directory. Jul 28, 2018 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.