mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-14 05:02:48 +08:00
Add more convenient key bindings for VI mode
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
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.
(cherry picked from commit f9b79926f1
)
This commit is contained in:
parent
13f7e6d0a5
commit
33fe575112
|
@ -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 New Issue
Block a user