2007-09-26 00:14:47 +08:00
|
|
|
|
|
|
|
function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fish"
|
|
|
|
|
|
|
|
# Clear earlier bindings, if any
|
|
|
|
bind --erase --all
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
# This is the default binding, i.e. the one used if no other binding matches
|
|
|
|
bind "" self-insert
|
|
|
|
|
|
|
|
bind \n execute
|
|
|
|
|
|
|
|
bind \ck kill-line
|
|
|
|
bind \cy yank
|
|
|
|
bind \t complete
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \e\n "commandline -i \n"
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \e\[A up-or-search
|
|
|
|
bind \e\[B down-or-search
|
|
|
|
bind -k down down-or-search
|
|
|
|
bind -k up up-or-search
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \e\[C forward-char
|
|
|
|
bind \e\[D backward-char
|
|
|
|
bind -k right forward-char
|
|
|
|
bind -k left backward-char
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
bind -k dc delete-char
|
|
|
|
bind -k backspace backward-delete-char
|
|
|
|
bind \x7f backward-delete-char
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \e\[H beginning-of-line
|
|
|
|
bind \e\[F end-of-line
|
2012-05-30 15:22:45 +08:00
|
|
|
|
|
|
|
# OS X SnowLeopard doesn't have these keys. Don't show an annoying error message.
|
|
|
|
bind -k home beginning-of-line 2> /dev/null
|
|
|
|
bind -k end end-of-line 2> /dev/null
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \e\eOC nextd-or-forward-word
|
|
|
|
bind \e\eOD prevd-or-backward-word
|
|
|
|
bind \e\e\[C nextd-or-forward-word
|
|
|
|
bind \e\e\[D prevd-or-backward-word
|
|
|
|
bind \eO3C nextd-or-forward-word
|
|
|
|
bind \eO3D prevd-or-backward-word
|
|
|
|
bind \e\[3C nextd-or-forward-word
|
|
|
|
bind \e\[3D prevd-or-backward-word
|
|
|
|
bind \e\[1\;3C nextd-or-forward-word
|
2010-09-18 10:18:26 +08:00
|
|
|
bind \e\[1\;3D prevd-or-backward-word
|
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \e\eOA history-token-search-backward
|
|
|
|
bind \e\eOB history-token-search-forward
|
|
|
|
bind \e\e\[A history-token-search-backward
|
|
|
|
bind \e\e\[B history-token-search-forward
|
|
|
|
bind \eO3A history-token-search-backward
|
|
|
|
bind \eO3B history-token-search-forward
|
|
|
|
bind \e\[3A history-token-search-backward
|
|
|
|
bind \e\[3B history-token-search-forward
|
|
|
|
bind \e\[1\;3A history-token-search-backward
|
|
|
|
bind \e\[1\;3B history-token-search-forward
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \ca beginning-of-line
|
|
|
|
bind \ce end-of-line
|
|
|
|
bind \ey yank-pop
|
|
|
|
bind \ch backward-delete-char
|
|
|
|
bind \cw backward-kill-word
|
|
|
|
bind \cp history-search-backward
|
|
|
|
bind \cn history-search-forward
|
|
|
|
bind \cf forward-char
|
|
|
|
bind \cb backward-char
|
2013-05-21 03:42:34 +08:00
|
|
|
bind \ct transpose-chars
|
2013-06-02 16:14:05 +08:00
|
|
|
bind \et transpose-words
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \e\x7f backward-kill-word
|
|
|
|
bind \eb backward-word
|
|
|
|
bind \ef forward-word
|
2010-11-25 04:15:10 +08:00
|
|
|
bind \e\[1\;5C forward-word
|
|
|
|
bind \e\[1\;5D backward-word
|
2013-09-01 05:29:14 +08:00
|
|
|
bind \e\[1\;9C forward-word #iTerm2
|
|
|
|
bind \e\[1\;9D backward-word #iTerm2
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \ed forward-kill-word
|
|
|
|
bind -k ppage beginning-of-history
|
|
|
|
bind -k npage end-of-history
|
|
|
|
bind \e\< beginning-of-buffer
|
|
|
|
bind \e\> end-of-buffer
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \el __fish_list_current_token
|
2013-01-07 22:54:21 +08:00
|
|
|
bind \ew 'set tok (commandline -pt); if test $tok[1]; echo; whatis $tok[1]; commandline -f repaint; end'
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \cl 'clear; commandline -f repaint'
|
2007-10-05 22:59:19 +08:00
|
|
|
bind \cc 'commandline ""'
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \cu backward-kill-line
|
|
|
|
bind \ed kill-word
|
2012-12-21 09:58:09 +08:00
|
|
|
bind \cw backward-kill-path-component
|
2013-01-07 22:54:21 +08:00
|
|
|
bind \ed 'set -l cmd (commandline); if test -z "$cmd"; echo; dirh; commandline -f repaint; else; commandline -f kill-word; end'
|
2007-09-26 00:14:47 +08:00
|
|
|
bind \cd delete-or-exit
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2007-09-26 00:14:47 +08:00
|
|
|
# This will make sure the output of the current command is paged using the less pager when you press Meta-p
|
2007-10-06 18:32:31 +08:00
|
|
|
bind \ep '__fish_paginate'
|
2013-04-29 05:36:11 +08:00
|
|
|
|
|
|
|
# term-specific special bindings
|
|
|
|
switch "$TERM"
|
|
|
|
case 'rxvt*'
|
|
|
|
bind \e\[8~ end-of-line
|
|
|
|
bind \eOc forward-word
|
|
|
|
bind \eOd backward-word
|
|
|
|
end
|
2007-09-26 00:14:47 +08:00
|
|
|
end
|