mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 15:30:40 +08: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
|
@ -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 <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 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'
|
||||
|
|
Loading…
Reference in New Issue
Block a user