From e7347b95811c0e27e0f317eb1a4a7852c4c3c4f6 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 19 Apr 2024 12:34:15 +0200 Subject: [PATCH] Bind ctrl-Z to redo (since ctrl-z is undo) In addition to the native Emacs undo binding, we also support ctrl-z. On Linux, ctrl-shift-z alias ctrl-Z is the redo binding according to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts Let's bind allow that. Unfortunately ctrl-shift and ctrl-alt modified shortcuts on Linux may be intercepted by the windowing system or the terminal. Only alt-shift seems to be available reliably (but the shift bit should mean "extend selection" in Emacs). --- CHANGELOG.rst | 1 + share/functions/fish_default_key_bindings.fish | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c0801e720..89b2e2099 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -140,6 +140,7 @@ New or improved bindings - When the cursor is on a command that resolves to an executable script, :kbd:`alt-o` will now open that script in your editor (:issue:`10266`). - During up-arrow history search, :kbd:`shift-delete` will delete the current search item and move to the next older item. Previously this was only supported in the history pager. Same for autosuggestions. +- :kbd:`ctrl-Z` (alias :kbd:`ctrl-shift-z`) is now bound to redo. - Some improvements to the :kbd:`alt-e` binding which edits the commandline in an external editor: - The editor's cursor position is copied back to fish. This is currently supported for Vim and Kakoune. - Cursor position synchronization is only supported for a set of known editors. This has been extended by also resolving aliases. For example use ``complete --wraps my-vim vim`` to synchronize cursors when `EDITOR=my-vim`. diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index 67aea33ab..ea186f26d 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -59,6 +59,7 @@ function fish_default_key_bindings -d "emacs-like key binds" bind --preset $argv ctrl-/ undo bind --preset $argv ctrl-_ undo # XTerm idiosyncracy, can get rid of this once we go full CSI u bind --preset $argv ctrl-z undo + bind --preset $argv ctrl-Z redo bind --preset $argv alt-/ redo bind --preset $argv alt-t transpose-words bind --preset $argv alt-u upcase-word