I have recently upgraded to Fedora 33 (Linux 5.9.16-200) on my machine. I am running vim-enhanced version 8.2. When I type sudo vim
(or even sudo vi
) in order to edit files with admin privilege, I get the following error.
sudo: __vi_internal_vim_alias: command not found
I am not sure what is causing this. Vim loads fine without the sudo. Could you please tell me how to troubleshoot this? Thank you.
Update:
Upon executing which vim
, I get the following result.
alias vim='__vi_internal_vim_alias'
__vi_internal_vim_alias ()
{
( test -f /usr/bin/vim && exec /usr/bin/vim "$@";
test -f /usr/bin/vi && exec /usr/bin/vi "$@" )
}
I am not sure what did this and where. Maybe it's a Fedora 33 thing. Given the above information, what do you suggest is a permanent fix?
Best Answer
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)
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
BASH Shell: Add to the .bashrc file (of the user you want to be affected by the changes)
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.