sudo keywork is ignored when alt+h is pressed

if `sudo` is in the beggining of the command string, then at alt+h press
the manual of the following command is shown instead.

Fixes https://github.com/fish-shell/fish-shell/issues/5982
This commit is contained in:
Kon Doumou 2019-09-18 23:35:33 +03:00 committed by Fabian Homborg
parent 26adff3378
commit e44d207d64

View file

@ -8,6 +8,12 @@ function __fish_man_page
return
end
#Skip `sudo` and display then manpage of following command
while set -q args[2]
and test $args[1] = "sudo"
set args $args[2..-1]
end
# If there are at least two tokens not starting with "-", the second one might be a subcommand.
# Try "man first-second" and fall back to "man first" if that doesn't work out.
set -l maincmd (basename $args[1])