mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 04:41:14 -03:00
Add replace mode in vi-mode
This commit is contained in:
@@ -12,6 +12,9 @@ function fish_default_mode_prompt --description "Display the default mode for th
|
||||
case replace_one
|
||||
set_color --bold --background green white
|
||||
echo '[R]'
|
||||
case replace
|
||||
set_color --bold --background cyan white
|
||||
echo '[R]'
|
||||
case visual
|
||||
set_color --bold --background magenta white
|
||||
echo '[V]'
|
||||
|
||||
@@ -218,6 +218,17 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
||||
bind -s --preset -M replace_one -m default \r 'commandline -f delete-char; commandline -i \n; commandline -f backward-char; commandline -f repaint-mode'
|
||||
bind -s --preset -M replace_one -m default \e cancel repaint-mode
|
||||
|
||||
#
|
||||
# Uppercase R, enters replace mode
|
||||
#
|
||||
bind -s --preset -m replace R repaint-mode
|
||||
bind -s --preset -M replace '' delete-char self-insert
|
||||
bind -s --preset -M replace -m insert \r execute repaint-mode
|
||||
bind -s --preset -M replace -m default \e cancel repaint-mode
|
||||
# in vim (and maybe in vi), <BS> deletes the changes
|
||||
# but this binding just move cursor backward, not delete the changes
|
||||
bind -s --preset -M replace -k backspace backward-char
|
||||
|
||||
#
|
||||
# visual mode
|
||||
#
|
||||
@@ -263,6 +274,7 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
||||
# the commenting chars so the command can be further edited then executed.
|
||||
bind -s --preset -M default \# __fish_toggle_comment_commandline
|
||||
bind -s --preset -M visual \# __fish_toggle_comment_commandline
|
||||
bind -s --preset -M replace \# __fish_toggle_comment_commandline
|
||||
|
||||
# Set the cursor shape
|
||||
# After executing once, this will have defined functions listening for the variable.
|
||||
|
||||
Reference in New Issue
Block a user