sudo: nocorrect: command not found
I have this alias alias sudo='sudo '
defined in a file which I source
d at the end of ~/.zshrc
file which overwrote alias sudo='nocorrect sudo'
which is defined in .oh-my-zsh/lib/correction.zsh
alias sudo='nocorrect sudo'
is required by zsh's auto-completion feature to work
More: How to disable autocorrection for sudo [command] in zsh?
But at same time I need alias sudo='sudo '
for aliases of commands following sudo
to work
More: Load aliases from .bashrc file while using sudo
Please note alias sudo='sudo '
works for zsh too
So I can either have zsh's auto-completion feature or have aliases (of other commands) while using sudo
so I have now disabled zsh's auto-completion feature.
(Hope I am clear and not confusing.)
Just adding to answer from @edward-torvalds,
In your .aliases file, the use of a Tab might not be visible enough for some. Your alias definition can be written as such for better reading:
alias sudo=$'nocorrect sudo\t'
However, I did have issues with a trailing space, but not a trailing tab.
alias sudo='sudo '
alias sudo='nocorrect sudo '
above aliases resulted in errors, as follows:
~$ which mkdir
mkdir: aliased to nocorrect mkdir -p -pv
~$ which sudo
sudo: aliased to nocorrect sudo
~$ alias sudo
sudo='nocorrect sudo '
~$ sudo mkdir /tmp/foo
sudo: nocorrect: command not found
Therefore, this would work alias sudo='sudo '
but I prefer alias sudo=$'nocorrect sudo\t'
in a 1K+ line zshrc, the latter is just too simple ;)
...if anyone can possibly say why, please comment!