From 1dc526884742ab41e6dbd168a2d45747cf04c4c6 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 24 Apr 2022 21:23:18 +0200 Subject: [PATCH] Bind Shift+Space CSI u sequence to Space Some terminals can be configured to send variuos escape sequences for keys that could historically not be detected. Turns out some usage pattern rely on those quirks. Shift+Space is easy to mistype when wanting to insert a space (especially when typing ALL CAPS). Map it to Space, to match user expectations. Similarly for Control+Return, for which xterm can be configured to send something other than \cr: echo 'XTerm.vt100.modifyOtherKeys: 1' | xrdb && xterm I'm working on a change to builtin bind that allows to bind CSI sequences via human-readable key names (#3018) but for now let's just map the raw sequences. Closes #8874 --- share/functions/__fish_shared_key_bindings.fish | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index f42983dff..bec3da179 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -187,10 +187,15 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod bind --preset $argv ")" self-insert expand-abbr # Ctrl-space inserts space without expanding abbrs bind --preset $argv -k nul 'commandline -i " "' + # Shift-space (CSI u escape sequence) behaves like space because it's easy to mistype. + bind --preset $argv \e\[32\;2u 'commandline -i " "; commandline -f expand-abbr'. bind --preset $argv \n execute bind --preset $argv \r execute + # Control+Return behave like Return because it's easy to mistype after accepting an autosuggestion. + bind --preset $argv \e\[27\;5\;13~ execute # Sent with XTerm.vt100.formatOtherKeys: 0 + bind --preset $argv \e\[13\;5u execute # CSI u sequence, sent with XTerm.vt100.formatOtherKeys: 1 end end