Refine when we expand abbreviations
- ctrl-space will insert a space without expanding abbrs - ")" or alt-enter will expand abbrs Fixes #6658
This commit is contained in:
parent
23a21eb318
commit
8ddd512fba
@ -1329,6 +1329,8 @@ Some bindings are shared between emacs- and vi-mode because they aren't text edi
|
||||
|
||||
- :kbd:`Alt`\ +\ :kbd:`S` Prepends `sudo` to the current commandline.
|
||||
|
||||
- :kbd:`Control`\ +\ :kbd:`Space` Inserts a space without expanding an :ref:`abbreviation <abbreviations>`. (for vi-mode this only applies to insert-mode)
|
||||
|
||||
.. _emacs-mode:
|
||||
|
||||
Emacs mode commands
|
||||
|
@ -39,8 +39,8 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
||||
# shift-tab does a tab complete followed by a search.
|
||||
bind --preset $argv --key btab complete-and-search
|
||||
|
||||
bind --preset $argv \e\n "commandline -i \n"
|
||||
bind --preset $argv \e\r "commandline -i \n"
|
||||
bind --preset $argv \e\n "commandline -f expand-abbr; commandline -i \n"
|
||||
bind --preset $argv \e\r "commandline -f expand-abbr; commandline -i \n"
|
||||
|
||||
bind --preset $argv -k down down-or-search
|
||||
bind --preset $argv -k up up-or-search
|
||||
|
@ -33,6 +33,10 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
|
||||
|
||||
# Space expands abbrs _and_ inserts itself.
|
||||
bind --preset $argv " " self-insert expand-abbr
|
||||
bind --preset $argv ")" self-insert expand-abbr
|
||||
# Ctrl-space inserts space without expanding abbrs
|
||||
bind -k nul 'commandline -i " "'
|
||||
|
||||
|
||||
bind --preset $argv \n execute
|
||||
bind --preset $argv \r execute
|
||||
|
@ -56,6 +56,9 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
||||
bind -s --preset -M insert "" self-insert
|
||||
# Space expands abbrs _and_ inserts itself.
|
||||
bind -s --preset -M insert " " self-insert expand-abbr
|
||||
bind --preset $argv ")" self-insert expand-abbr
|
||||
# Ctrl-space inserts space without expanding abbrs
|
||||
bind -k nul 'commandline -i " "'
|
||||
|
||||
# Add a way to switch from insert to normal (command) mode.
|
||||
# Note if we are paging, we want to stay in insert mode
|
||||
|
Loading…
x
Reference in New Issue
Block a user