aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/fish_default_key_bindings.fish
blob: 8db6d8037cb35cc08b4db17e1bbe27e62a5fb199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fish"

	# Clear earlier bindings, if any
	bind --erase --all
	
	# 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
	
	bind \e\n "commandline -i \n"
	
	bind \e\[A up-or-search
	bind \e\[B down-or-search
	bind -k down down-or-search
	bind -k up up-or-search
	
	bind \e\[C forward-char
	bind \e\[D backward-char
	bind -k right forward-char
	bind -k left backward-char
	
	bind -k dc delete-char
	bind -k backspace backward-delete-char
	bind \x7f backward-delete-char
	
	bind \e\[H beginning-of-line
	bind \e\[F end-of-line
	bind -k home beginning-of-line
	bind -k end end-of-line
	
	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
	bind \e\[1\;3D prevd-or-backward-word		
			
	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
	
	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
	bind \e\x7f backward-kill-word
	bind \eb backward-word
	bind \ef forward-word
	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
	
	bind \el __fish_list_current_token
	bind \ew 'set tok (commandline -pt); if test $tok[1]; whatis $tok[1]; commandline -f repaint; end'
	bind \cl 'clear; commandline -f repaint'
	bind \cc delete-line
	bind \cu backward-kill-line
	bind \ed kill-word
	bind \cw backward-kill-word	
	bind \ed 'if test -z (commandline); dirh; commandline -f repaint; else; commandline -f kill-word; end'
	bind \cd delete-or-exit
	
	# This will make sure the output of the current command is paged using the less pager when you press Meta-p
	bind \ep 'if commandline -j|grep -v "less *\$" >/dev/null; commandline -aj "|less;"; end'
	
end