Skip to content
Advertisement

How to make zsh `run-help` to ignore `sudo` and get help about the following command

Is it possible to customize zsh so that when I type, say, sudo ls and then hit Alt-h to see man page of the command ls. The default behavior of run-help is to show me the man page of the command sudo, instead of ls.

Advertisement

Answer

Yes, you can. Run the following lines or add them to your .zshrc.

autoload -U run-help
autoload run-help-sudo

from zsh wiki:

[run-help] can be further customized by defining helper functions of the form run-help-command.

There are other helper functions, as of version 5.0.8:

  • run-help-git
  • run-help-ip
  • run-help-openssl
  • run-help-p4
  • run-help-sudo
  • run-help-svk
  • run-help-svn

If you are running a Debian, you can find all helper functions function by:

dpkg -L zsh-common | grep run-help

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement