diff --git a/share/functions/__fish_man_page.fish b/share/functions/__fish_man_page.fish index 38979eeee..192b92077 100644 --- a/share/functions/__fish_man_page.fish +++ b/share/functions/__fish_man_page.fish @@ -10,8 +10,8 @@ function __fish_man_page #Skip `sudo` and display then manpage of following command while set -q args[2] - and test $args[1] = "sudo" - set args $args[2..-1] + and string match -qr -- '^(sudo|.*=.*)$' $args[1] + set -e args[1] end # If there are at least two tokens not starting with "-", the second one might be a subcommand. diff --git a/share/functions/__fish_prepend_sudo.fish b/share/functions/__fish_prepend_sudo.fish index a696d8ac3..aaca6c37a 100644 --- a/share/functions/__fish_prepend_sudo.fish +++ b/share/functions/__fish_prepend_sudo.fish @@ -1,5 +1,5 @@ function __fish_prepend_sudo -d "Prepend 'sudo ' to the beginning of the current commandline" - set -l cmd (commandline -boc) + set -l cmd (commandline -poc) if test "$cmd[1]" != "sudo" commandline -C 0 commandline -i "sudo "