Vi mode: hack in support for df and friends

Commit 38e633d49b (fish_vi_key_bindings: add support for count,
2025-12-16) introduced an operator mode which kind of makes a lot of
sense for today's fish.  If we end up needing more flexibility and
tighter integration, we might want to move some of this into core.

Unfortunately the change is at odds with our cursed forward-jump
implementation.  The forward-jump special input function works by
magically reading the next key from stdin, which causes problems when
we are executing a script:

	commandline -f begin-selection
	commandline -f forward-jump
	commandline -f end-selection

here end-selection will be executed immediately
and forward-jump fails to wait for a keystroke.

We should get rid of forward-jump implementation.

For now, replace only the broken thing with a dedicated bind mode
for each of f/F/t/T.

Fixes #12417
This commit is contained in:
Johannes Altmanninger
2026-02-06 13:17:36 +11:00
parent 6f895935a9
commit d25965afba
10 changed files with 138 additions and 38 deletions

View File

@@ -401,6 +401,13 @@ The following special input functions are available:
``self-insert-notfirst``
inserts the matching sequence into the command line, unless the cursor is at the beginning
``get-key``
sets :envvar:`fish_key` to the key that was pressed to trigger this binding. Example use::
for i in (seq 0 9)
bind $i get-key 'commandline -i "#$fish_key"' 'set -eg fish_key'
end
``suppress-autosuggestion``
remove the current autosuggestion. Returns true if there was a suggestion to remove.

View File

@@ -55,7 +55,7 @@ Example
case visual
set_color --bold brmagenta
echo 'V'
case operator
case operator f F t T
set_color --bold cyan
echo 'N'
case '*'