From 1ff8f983c4d55ba0bae3a1e5eaee7fed0293e869 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 2 May 2025 05:35:42 +0200 Subject: [PATCH] Remove obsolete Vi mode delete key workaround As reported in https://matrix.to/#/!YLTeaulxSDauOOxBoR:matrix.org/$n20_uqiMqatEQcPG79Ca0c2_YvHBHTr-yCVXTEuze_Y commit f5fac096c0a (Don't move cursor in delete-char, 2017-04-19) fixed the behavior of Vi mode keys "delete" and "x" when the cursor is at the end of the buffer, and commit d51f669647f (Vi mode: avoid placing cursor beyond last character, 2024-02-14) generalized this fix. This means that the delete-specific fix is no longer necessary. Remove it. Note that if the cursor is at end of a line but not the last line, the behavior of "delete" in Vi mode is still wrong. It should stay on the line. --- share/functions/fish_vi_key_bindings.fish | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index edde7b30f..fbf5313be 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -113,13 +113,10 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind -s --preset -M insert end end-of-line bind -s --preset -M default end end-of-line - # Vi moves the cursor back if, after deleting, it is at EOL. - # To emulate that, move forward, then backward, which will be a NOP - # if there is something to move forward to. - bind -s --preset -M default x delete-char 'set fish_cursor_end_mode exclusive' forward-single-char backward-char 'set fish_cursor_end_mode inclusive' + bind -s --preset -M default x delete-char bind -s --preset -M default X backward-delete-char - bind -s --preset -M insert delete delete-char forward-single-char backward-char - bind -s --preset -M default delete delete-char 'set fish_cursor_end_mode exclusive' forward-single-char backward-char 'set fish_cursor_end_mode inclusive' + bind -s --preset -M insert delete delete-char + bind -s --preset -M default delete delete-char # Backspace deletes a char in insert mode, but not in normal/default mode. bind -s --preset -M insert backspace backward-delete-char