2013-12-31 08:52:41 +08:00
|
|
|
function fish_vi_key_bindings -d "vi-like key bindings for fish"
|
|
|
|
|
|
|
|
bind --erase --all
|
|
|
|
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
##
|
|
|
|
## command mode
|
|
|
|
##
|
|
|
|
#bind -m command : force-repaint
|
|
|
|
#bind -M command q exit
|
|
|
|
#bind -M command -m default \e force-repaint
|
|
|
|
#bind -M command -m default \cc force-repaint
|
|
|
|
|
|
|
|
bind :q exit
|
|
|
|
|
2013-12-31 08:52:41 +08:00
|
|
|
#
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
# normal (default) mode
|
2013-12-31 08:52:41 +08:00
|
|
|
#
|
|
|
|
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind \cd exit
|
2013-12-31 08:52:41 +08:00
|
|
|
bind h backward-char
|
|
|
|
bind l forward-char
|
|
|
|
bind \e\[C forward-char
|
|
|
|
bind \e\[D backward-char
|
|
|
|
bind -k right forward-char
|
|
|
|
bind -k left backward-char
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind \n execute
|
2013-12-31 21:53:29 +08:00
|
|
|
bind -m insert i force-repaint
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind -m insert I beginning-of-line force-repaint
|
2014-01-01 07:11:32 +08:00
|
|
|
bind -m insert a forward-char force-repaint
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind -m insert A end-of-line force-repaint
|
2014-01-15 22:07:22 +08:00
|
|
|
bind -m visual v begin-selection force-repaint
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
|
|
|
|
bind -m insert o "commandline -a \n" down-line force-repaint
|
|
|
|
#bind -m insert O beginning-of-line "commandline -i \n" up-line force-repaint # doesn't work
|
|
|
|
|
|
|
|
bind gg beginning-of-buffer
|
|
|
|
bind G end-of-buffer
|
2013-12-31 08:52:41 +08:00
|
|
|
|
|
|
|
bind \x24 end-of-line
|
|
|
|
bind \x5e beginning-of-line
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind g\x24 end-of-line
|
|
|
|
bind g\x5e beginning-of-line
|
2013-12-31 08:52:41 +08:00
|
|
|
bind \e\[H beginning-of-line
|
|
|
|
bind \e\[F end-of-line
|
|
|
|
|
2013-12-31 21:53:29 +08:00
|
|
|
# NOTE: history-search-backward and history-search-forward
|
|
|
|
# must both be bound for `commandline -f ...' to work, and thus for up-or-search
|
|
|
|
# and down-or-search to work, since those are actually
|
|
|
|
# simple shell functions that use `commandline -f ...'.
|
|
|
|
# Generally, commandline -f can only invoke functions that have been bound previously
|
|
|
|
|
|
|
|
bind u history-search-backward
|
|
|
|
bind \cr history-search-forward
|
|
|
|
|
2013-12-31 08:52:41 +08:00
|
|
|
bind k up-or-search
|
|
|
|
bind j down-or-search
|
|
|
|
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 b backward-word
|
|
|
|
bind B backward-word
|
|
|
|
bind w forward-word
|
|
|
|
bind W backward-word
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind e forward-word
|
|
|
|
bind E backward-word
|
|
|
|
|
|
|
|
bind x delete-char
|
|
|
|
bind X backward-delete-char
|
|
|
|
|
|
|
|
bind -k dc delete-char
|
|
|
|
|
|
|
|
bind -k backspace backward-delete-char
|
|
|
|
bind \x7f backward-delete-char
|
|
|
|
bind \e\[3\;2~ backward-delete-char # Mavericks Terminal.app shift-delete
|
|
|
|
|
|
|
|
bind dd kill-whole-line
|
|
|
|
bind D kill-line
|
|
|
|
bind d\x24 kill-line
|
|
|
|
bind d\x5e backward-kill-line
|
|
|
|
bind dw kill-word
|
|
|
|
bind dW backward-kill-word
|
|
|
|
bind de kill-word
|
|
|
|
bind dE backward-kill-word
|
|
|
|
bind db backward-kill-word
|
|
|
|
bind dB kill-word
|
|
|
|
|
|
|
|
bind -m insert s delete-char force-repaint
|
|
|
|
bind -m insert S kill-whole-line force-repaint
|
|
|
|
bind -m insert cc kill-whole-line force-repaint
|
|
|
|
bind -m insert C kill-line force-repaint
|
|
|
|
bind -m insert c\x24 kill-line force-repaint
|
|
|
|
bind -m insert c\x5e backward-kill-line force-repaint
|
|
|
|
bind -m insert cw kill-word force-repaint
|
|
|
|
bind -m insert ce kill-word force-repaint
|
|
|
|
bind -m insert cb backward-kill-word force-repaint
|
|
|
|
|
|
|
|
bind '~' capitalize-word
|
|
|
|
bind gu downcase-word
|
|
|
|
bind gU upcase-word
|
|
|
|
|
|
|
|
bind J end-of-line delete-char
|
|
|
|
bind K 'man (basename (commandline -po; echo))[1] ^/dev/null; or echo -n \a'
|
|
|
|
|
|
|
|
bind yy kill-whole-line yank
|
|
|
|
bind Y kill-whole-line yank
|
|
|
|
bind y\x24 kill-line yank
|
|
|
|
bind y\x5e backward-kill-line yank
|
|
|
|
bind yw kill-word yank
|
|
|
|
bind yW backward-kill-word yank
|
|
|
|
bind ye kill-word yank
|
|
|
|
bind yE backward-kill-word yank
|
|
|
|
bind yb backward-kill-word yank
|
|
|
|
bind yB kill-word yank
|
|
|
|
|
|
|
|
bind p yank
|
|
|
|
bind P backward-char yank-pop
|
2013-12-31 08:52:41 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# insert mode
|
|
|
|
#
|
|
|
|
|
|
|
|
bind -M insert "" self-insert
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind -M insert \n execute
|
2013-12-31 08:52:41 +08:00
|
|
|
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind -M insert -k dc delete-char
|
2014-01-14 22:24:26 +08:00
|
|
|
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind -M insert -k backspace backward-delete-char
|
|
|
|
bind -M insert \x7f backward-delete-char
|
2014-01-14 22:24:26 +08:00
|
|
|
# Mavericks Terminal.app shift-delete
|
|
|
|
bind -M insert \e\[3\;2~ backward-delete-char
|
|
|
|
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind -M insert \t complete
|
2013-12-31 21:53:29 +08:00
|
|
|
|
|
|
|
bind -M insert \e\[A up-or-search
|
|
|
|
bind -M insert \e\[B down-or-search
|
|
|
|
bind -M insert -k down down-or-search
|
|
|
|
bind -M insert -k up up-or-search
|
|
|
|
|
|
|
|
bind -M insert \e\[C forward-char
|
|
|
|
bind -M insert \e\[D backward-char
|
|
|
|
bind -M insert -k right forward-char
|
|
|
|
bind -M insert -k left backward-char
|
2014-01-14 22:24:26 +08:00
|
|
|
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
bind -M insert -m default \cc force-repaint
|
2013-12-31 23:16:28 +08:00
|
|
|
bind -M insert -m default \e force-repaint
|
Update vi bindings:
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
2014-01-15 00:21:13 +08:00
|
|
|
|
|
|
|
bind -M insert \cd exit
|
|
|
|
|
|
|
|
bind -M insert \ef forward-word
|
2014-01-15 22:07:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# visual mode
|
|
|
|
#
|
|
|
|
|
|
|
|
bind -M visual \e\[C forward-char
|
|
|
|
bind -M visual \e\[D backward-char
|
|
|
|
bind -M visual -k right forward-char
|
|
|
|
bind -M visual -k left backward-char
|
|
|
|
bind -M visual h backward-char
|
|
|
|
bind -M visual l forward-char
|
|
|
|
|
|
|
|
bind -M visual -m default \cc end-selection force-repaint
|
|
|
|
bind -M visual -m default \e end-selection force-repaint
|
2013-12-31 08:52:41 +08:00
|
|
|
end
|