fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
cb1de5aab
master
1function fish_default_key_bindings -d"emacs-like key binds" 2if contains -- -h$argv 3or contains -- --help$argv 4echo "Sorry but this function doesn't support -h or --help" 5return 1 6end 7 8if not set -q argv[ 1 ] 9bind --erase --all --preset# clear earlier bindings, if any 10if test " $fish_key_bindings " != fish_default_key_bindings 11__fish_change_key_bindings fish_default_key_bindings 12set fish_bind_mode default 13end 14end 15 16# These are shell-specific bindings that we share with vi mode. 17eval "$ ( __fish_shared_key_bindings ) " $argv 18or return # protect against invalid $argv 19 20bind --preset$argv right forward-char 21bind --preset$argv left backward-char 22 23bind --preset$argv delete delete-char 24bind --preset$argv backspace backward-delete-char 25bind --preset$argv shift-backspace backward-delete-char 26 27bind --preset$argv home beginning-of-line 28bind --preset$argv end end-of-line 29 30bind --preset$argv ctrl-a beginning-of-line 31bind --preset$argv ctrl-e end-of-line 32bind --preset$argv ctrl-h backward-delete-char 33bind --preset$argv ctrl-p up-or-search 34bind --preset$argv ctrl-n down-or-search 35bind --preset$argv ctrl-f forward-char 36bind --preset$argv ctrl-b backward-char 37bind --preset$argv ctrl-t transpose-chars 38bind --preset$argv ctrl-g cancel 39bind --preset$argv ctrl-/ undo 40bind --preset$argv ctrl-_ undo# XTerm idiosyncracy, can get rid of this once we go full CSI u 41bind --preset$argv ctrl-z undo 42bind --preset$argv ctrl-shift-z redo 43bind --preset$argv alt-/ redo 44bind --preset$argv alt-t transpose-words 45bind --preset$argv alt-u upcase-word 46 47bind --preset$argv alt-c capitalize-word 48 49bind --preset$argv alt-backspace backward-kill-word 50bind --preset$argv ctrl-alt-h backward-kill-word 51bind --preset$argv ctrl-backspace backward-kill-token 52bind --preset$argv alt-delete kill-word 53bind --preset$argv ctrl-delete kill-token 54 55bind --preset$argv alt-\< beginning-of-buffer 56bind --preset$argv alt-\> end-of-buffer 57 58bind --preset$argv ctrl-r history-pager 59 60# TODO(term-workaround) 61switch " $TERM " 62case xterm-256color 63# Microsoft's conemu uses xterm-256color plus 64# the following to tell a console to paste: 65bind --preset$argv \e\x20 ep fish_clipboard_paste 66end 67end