mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Add Meta+H as keybinding for man page.
Apparently, in zsh, Meta+H can be used to display the manpage for the current command. This commit adds this zsh feature to fish shell. The F1 keybinding is left, although it's now secondary according to fish help, as some terminal emulators don't let the user press F1 key.
This commit is contained in:
parent
b00cbae4b5
commit
26051ea198
3 changed files with 8 additions and 3 deletions
|
@ -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{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 <a href="commands.html#bind">bind</a> builtin command.
|
You can change these key bindings using the <a href="commands.html#bind">bind</a> builtin command.
|
||||||
|
|
||||||
|
|
4
share/functions/__fish_man_page.fish
Normal file
4
share/functions/__fish_man_page.fish
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
function __fish_man_page
|
||||||
|
man (basename (commandline -po; echo)[1]) ^/dev/null
|
||||||
|
or printf \a
|
||||||
|
end
|
|
@ -111,8 +111,9 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
|
||||||
bind \ed forward-kill-word
|
bind \ed forward-kill-word
|
||||||
bind \ed kill-word
|
bind \ed kill-word
|
||||||
|
|
||||||
# Allow reading manpages by pressing F1
|
# Allow reading manpages by pressing F1 (many GUI applications) or Alt+h (like in zsh)
|
||||||
bind $argv -k f1 'man (basename (commandline -po; echo)[1]) ^/dev/null; or echo -n \a'
|
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
|
# 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'
|
bind $argv \ep '__fish_paginate'
|
||||||
|
|
Loading…
Reference in a new issue