mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-25 19:25:06 +00:00
Add more convenient key bindings for VI mode
To make it more familiar to vi/vim users. In all mode, ctrl-k is bind to kill-line. In Vi visual mode: * press v or i turn into normal or insert mode respectively. * press I turn to insert mode and move the cursor to beginning of line. * because fish doesn't have upcase/locase-selection, and most people reach for g-U rather than g-u, g-U binds to togglecase-selection temporarily.
This commit is contained in:
parent
6c3150aa05
commit
f9b79926f1
2 changed files with 5 additions and 0 deletions
|
@ -69,6 +69,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
|||
bind --preset $argv ctrl-l clear-screen
|
||||
bind --preset $argv ctrl-c cancel-commandline
|
||||
bind --preset $argv ctrl-u backward-kill-line
|
||||
bind --preset $argv ctrl-k kill-line
|
||||
bind --preset $argv ctrl-w backward-kill-path-component
|
||||
bind --preset $argv end end-of-line
|
||||
bind --preset $argv home beginning-of-line
|
||||
|
|
|
@ -312,6 +312,9 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
|||
bind -s --preset -M visual $key beginning-of-line
|
||||
end
|
||||
|
||||
bind -s --preset -M visual -m default v end-selection repaint-mode
|
||||
bind -s --preset -M visual -m insert i end-selection repaint-mode
|
||||
bind -s --preset -M visual -m insert I end-selection beginning-of-line repaint-mode
|
||||
bind -s --preset -M visual -m insert c kill-selection end-selection repaint-mode
|
||||
bind -s --preset -M visual -m insert s kill-selection end-selection repaint-mode
|
||||
bind -s --preset -M visual -m default d kill-selection end-selection backward-char repaint-mode
|
||||
|
@ -321,6 +324,7 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
|||
bind -s --preset -M visual -m default '",*,y' "fish_clipboard_copy; commandline -f end-selection repaint-mode"
|
||||
bind -s --preset -M visual -m default '",+,y' "fish_clipboard_copy; commandline -f end-selection repaint-mode"
|
||||
bind -s --preset -M visual -m default '~' togglecase-selection end-selection repaint-mode
|
||||
bind -s --preset -M visual -m default g,U togglecase-selection end-selection repaint-mode
|
||||
|
||||
bind -s --preset -M visual -m default ctrl-c end-selection repaint-mode
|
||||
bind -s --preset -M visual -m default escape end-selection repaint-mode
|
||||
|
|
Loading…
Reference in a new issue