mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 05:37:10 +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
This commit is contained in:
parent
874d3aca45
commit
b0e94c15e6
|
@ -2,13 +2,21 @@ function fish_vi_key_bindings -d "vi-like key bindings for fish"
|
|||
|
||||
bind --erase --all
|
||||
|
||||
##
|
||||
## 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
|
||||
|
||||
#
|
||||
# command (default) mode
|
||||
# normal (default) mode
|
||||
#
|
||||
|
||||
bind \cd exit
|
||||
bind :q exit
|
||||
|
||||
bind h backward-char
|
||||
bind l forward-char
|
||||
bind \e\[C forward-char
|
||||
|
@ -17,10 +25,20 @@ function fish_vi_key_bindings -d "vi-like key bindings for fish"
|
|||
bind -k left backward-char
|
||||
bind \n execute
|
||||
bind -m insert i force-repaint
|
||||
bind -m insert I beginning-of-line force-repaint
|
||||
bind -m insert a forward-char force-repaint
|
||||
bind -m insert A end-of-line force-repaint
|
||||
|
||||
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
|
||||
|
||||
bind \x24 end-of-line
|
||||
bind \x5e beginning-of-line
|
||||
bind g\x24 end-of-line
|
||||
bind g\x5e beginning-of-line
|
||||
bind \e\[H beginning-of-line
|
||||
bind \e\[F end-of-line
|
||||
|
||||
|
@ -44,11 +62,59 @@ function fish_vi_key_bindings -d "vi-like key bindings for fish"
|
|||
bind B backward-word
|
||||
bind w forward-word
|
||||
bind W backward-word
|
||||
bind e forward-word
|
||||
bind E backward-word
|
||||
|
||||
bind dd kill-line
|
||||
bind x delete-char
|
||||
bind X backward-delete-char
|
||||
|
||||
bind y yank
|
||||
bind p yank-pop
|
||||
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
|
||||
|
||||
#
|
||||
# insert mode
|
||||
|
@ -78,4 +144,8 @@ function fish_vi_key_bindings -d "vi-like key bindings for fish"
|
|||
|
||||
bind -M insert -m default \cc force-repaint
|
||||
bind -M insert -m default \e force-repaint
|
||||
|
||||
bind -M insert \cd exit
|
||||
|
||||
bind -M insert \ef forward-word
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user