diff --git a/share/functions/fish_default_mode_prompt.fish b/share/functions/fish_default_mode_prompt.fish index 27a9c9f62..afd5e38ca 100644 --- a/share/functions/fish_default_mode_prompt.fish +++ b/share/functions/fish_default_mode_prompt.fish @@ -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]' diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index 718205206..12f1cdff9 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -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), 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.