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).
This commit is contained in:
Johannes Altmanninger 2024-04-19 12:34:15 +02:00
parent 5756fa369f
commit e7347b9581
2 changed files with 2 additions and 0 deletions

View File

@ -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`). - 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. - 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. 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: - 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. - 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`. - 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`.

View File

@ -59,6 +59,7 @@ function fish_default_key_bindings -d "emacs-like key binds"
bind --preset $argv ctrl-/ undo 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-_ 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 undo
bind --preset $argv ctrl-Z redo
bind --preset $argv alt-/ redo bind --preset $argv alt-/ redo
bind --preset $argv alt-t transpose-words bind --preset $argv alt-t transpose-words
bind --preset $argv alt-u upcase-word bind --preset $argv alt-u upcase-word