diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in index fdceee1b2..4118cee86 100644 --- a/doc_src/index.hdr.in +++ b/doc_src/index.hdr.in @@ -896,7 +896,7 @@ Similar to bash, fish has Emacs and Vi editing modes. The default editing mode i - @key{Alt,U} makes the current word uppercase. -- @key{F1} shows the manual page for the current command, if one exists. +- @key{Alt,H} (or @key{F1}) shows the manual page for the current command, if one exists. You can change these key bindings using the bind builtin command. diff --git a/share/functions/__fish_man_page.fish b/share/functions/__fish_man_page.fish new file mode 100644 index 000000000..17a903153 --- /dev/null +++ b/share/functions/__fish_man_page.fish @@ -0,0 +1,4 @@ +function __fish_man_page + man (basename (commandline -po; echo)[1]) ^/dev/null + or printf \a +end diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index d33f7b53e..120a35731 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -111,8 +111,9 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis bind \ed forward-kill-word bind \ed kill-word - # Allow reading manpages by pressing F1 - bind $argv -k f1 'man (basename (commandline -po; echo)[1]) ^/dev/null; or echo -n \a' + # Allow reading manpages by pressing F1 (many GUI applications) or Alt+h (like in zsh) + bind $argv -k f1 __fish_man_page + bind $argv \eh __fish_man_page # This will make sure the output of the current command is paged using the less pager when you press Meta-p bind $argv \ep '__fish_paginate'