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
This commit is contained in:
Johannes Altmanninger 2022-04-24 21:23:18 +02:00
parent c34e694126
commit 1dc5268847

View File

@ -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