From 2e9de57fd78f1c9ee0e71e141b75bb2b24abfc2d Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 23 Sep 2024 14:42:46 +0200 Subject: [PATCH] Document ctrl-backspace and bind ctrl-delete as well This has a slightly different behavior than what the CUA user expects: it fails to eat up trailing spaces. We should probably fix this. --- CHANGELOG.rst | 1 + doc_src/interactive.rst | 4 ++-- share/functions/fish_default_key_bindings.fish | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d0571b51a..85f946a2a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -178,6 +178,7 @@ New or improved bindings - The following keys have refined behavior if the terminal supports `disambiguating them `_: - :kbd:`shift-enter` now inserts a newline instead of executing the command line. - :kbd:`ctrl-backspace` now deletes the last word instead of only one character. + - :kbd:`ctrl-delete` deletes the next word (same as :kbd:`alt-d`). - New special input functions ``forward-char-passive`` and ``backward-char-passive`` are like their non-passive variants but do not accept autosuggestions or move focus in the completion pager (:issue:`10398`). - Vi mode has seen some improvements but continues to suffer from the lack of people working on it. - Insert-mode :kbd:`ctrl-n` accepts autosuggestions (:issue:`10339`). diff --git a/doc_src/interactive.rst b/doc_src/interactive.rst index 682e960b3..60a43f11d 100644 --- a/doc_src/interactive.rst +++ b/doc_src/interactive.rst @@ -325,7 +325,7 @@ Some bindings are common across Emacs and vi mode, because they aren't text edit - :kbd:`ctrl-x` copies the current buffer to the system's clipboard, :kbd:`ctrl-v` inserts the clipboard contents. (see :doc:`fish_clipboard_copy ` and :doc:`fish_clipboard_paste `) -- :kbd:`alt-d` moves the next word to the :ref:`killring`. +- :kbd:`alt-d` or :kbd:`ctrl-delete` moves the next word to the :ref:`killring`. - :kbd:`alt-h` (or :kbd:`f1`) shows the manual page for the current command, if one exists. @@ -362,7 +362,7 @@ To enable emacs mode, use :doc:`fish_default_key_bindings ` moves to the end. diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index 9b369d1aa..816c0071f 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -76,6 +76,7 @@ function fish_default_key_bindings -d "emacs-like key binds" bind --preset $argv alt-c capitalize-word bind --preset $argv alt-backspace backward-kill-word bind --preset $argv ctrl-backspace backward-kill-word + bind --preset $argv ctrl-delete kill-word bind --preset $argv alt-b backward-word bind --preset $argv alt-f forward-word if test "$TERM_PROGRAM" = Apple_Terminal