How to resolve __vi_internal_vim_alias: command not found?
Hitting the same issue on Fedora 33.
This seems due to having an alias defined for sudo
in my environment:
$ alias sudo
alias sudo='\sudo '
Due to this, somehow bash resolves aliases passed as arguments to sudo
alias, as shown in the example below:
$ alias foo='echo foo'
$ sudo foo
foo
I would have expected to have this instead:
$ sudo foo
$ sudo: foo: command not found
Deleting this alias worked for me. This alias was created by /usr/local/bin/alias.sh
, part of synth-shell
project (https://github.com/andresgongora/synth-shell)
As @scy mentioned unalias-ing the vi and vim is a workaround solution for keeping the sudo="sudo " alias so it can be used with other aliases.
Expanding his/her answer for the different shells:
ZSH Shell: Add to the .zshrc file (of the user you want to be affected by the changes)
- located at:
For Fedora 33 Workstation(or Server or another non-atomic OS Distro): /home/$USER/.zshrc
For Fedora CoreOS 33.x (or Silverblue 33 or other similar atomic OS Distro): /var/home/$USER/.zshrc
- the following lines of code:
[ "$(type -w vi)" = 'vi: alias' ] && unalias vi
[ "$(type -w vim)" = 'vim: alias' ] && unalias vim
BASH Shell: Add to the .bashrc file (of the user you want to be affected by the changes)
- located at the same locations, respective to the OS/Distro specific location for the $USER 's home directory (check the directions for Fedora Workstation, etc...)
- the following code:
[ "$(type -t vi)" = 'alias' ] && unalias vi
[ "$(type -t vim)" = 'alias' ] && unalias vim
P.S. Concerning ZSH Shell, this solution can resolve similar problems with other CLI applications that are in a similar initialization situation. For example: mc (Midnight Commander). Meanwhile, mc will not have any such problem in BASH Shell.