Fix vi key bindings regression when called with argument

Commit bbb2f0de8d added a ctrl-right binding to override the shared
binding with forward-word-vi for vi-compliance. However, it incorrectly
passed $argv which caused the error:
  "bind: cannot parse key 'default'"

when calling fish_vi_key_bindings with a mode argument like:
  fish_vi_key_bindings "default"

Fix that.

Co-Authored-By: Johannes Altmanninger <aclopte@gmail.com>

Closes #12413
This commit is contained in:
Simon Olofsson
2026-02-04 10:05:37 +01:00
committed by Johannes Altmanninger
parent 779f1371a1
commit 6d01138797

View File

@@ -267,6 +267,8 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
# Do this first so vi-bindings win over default.
for mode in insert default visual
__fish_shared_key_bindings -s -M $mode
__fish_per_os_bind --preset -M $mode ctrl-right forward-token forward-word-vi
# ctrl-left is same as emacs mode
end
# Add a way to switch from insert to normal (command) mode.
@@ -349,9 +351,6 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
bind -s --preset ] history-token-search-forward
bind -s --preset -m insert / history-pager repaint-mode
__fish_per_os_bind --preset $argv ctrl-right forward-token forward-word-vi
# ctrl-left is same as emacs mode
bind -s --preset -M insert ctrl-n accept-autosuggestion
# Vi/Vim doesn't support these keys in insert mode but that seems silly so we do so anyway.