Allow alt-enter and friends to insert into search field

Since this is user-visible, copy the logic rather than extracting
a function.
This commit is contained in:
Johannes Altmanninger 2025-01-10 08:52:43 +01:00
parent 0f1408e0ea
commit 4a6d8d0b3a

View file

@ -112,13 +112,14 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
bind --preset $argv "&" self-insert expand-abbr bind --preset $argv "&" self-insert expand-abbr
bind --preset $argv ">" self-insert expand-abbr bind --preset $argv ">" self-insert expand-abbr
bind --preset $argv "<" self-insert expand-abbr bind --preset $argv "<" self-insert expand-abbr
bind --preset $argv shift-enter "commandline -i \n" expand-abbr set -l maybe_search_field '(commandline --search-field >/dev/null && echo --search-field)'
bind --preset $argv alt-enter "commandline -i \n" expand-abbr bind --preset $argv shift-enter "commandline -i \n $maybe_search_field" expand-abbr
bind --preset $argv alt-enter "commandline -i \n $maybe_search_field" expand-abbr
bind --preset $argv ")" self-insert expand-abbr # Closing a command substitution. bind --preset $argv ")" self-insert expand-abbr # Closing a command substitution.
bind --preset $argv ctrl-space 'test -n "$(commandline)" && commandline -i " "' bind --preset $argv ctrl-space 'test -n "$(commandline)" && commandline -i " " '$maybe_search_field
bind --preset $argv -k nul 'test -n "$(commandline)" && commandline -i " "' bind --preset $argv -k nul 'test -n "$(commandline)" && commandline -i " " '$maybe_search_field
# Shift-space behaves like space because it's easy to mistype. # Shift-space behaves like space because it's easy to mistype.
bind --preset $argv shift-space 'commandline -i " "' expand-abbr bind --preset $argv shift-space 'commandline -i " " '$maybe_search_field expand-abbr
bind --preset $argv enter execute bind --preset $argv enter execute
bind --preset $argv ctrl-j execute bind --preset $argv ctrl-j execute