Make alt-{b,f} move in directory history if commandline is empty

alt-{left,right} move in the directory history (like in browsers).
Arrow keys can be inconvenient to reach on some keyboards, so
let's alias this to alt-{b,f}, which already have similar behavior.
(historically the behavior was the same; we're considering changing
that back on some platforms).

This happens to fix alt-{left,right} in Terminal.app (where we had
a workaround for some cases), Ghostty, though that alone should not
be the reason for this change.

Closes #11105
This commit is contained in:
Johannes Altmanninger
2025-01-06 21:09:41 +01:00
parent 9e19e419a4
commit f4503af037
2 changed files with 4 additions and 8 deletions

View File

@@ -59,14 +59,8 @@ function fish_default_key_bindings -d "emacs-like key binds"
bind --preset $argv ctrl-backspace backward-kill-word
bind --preset $argv alt-delete kill-token
bind --preset $argv ctrl-delete kill-word
bind --preset $argv alt-b backward-word
bind --preset $argv alt-f forward-word
if test "$TERM_PROGRAM" = Apple_Terminal
# Terminal.app sends \eb for alt+left, \ef for alt+right.
# Yeah.
$legacy_bind --preset $argv alt-b prevd-or-backward-word
$legacy_bind --preset $argv alt-f nextd-or-forward-word
end
bind --preset $argv alt-b prevd-or-backward-word
bind --preset $argv alt-f nextd-or-forward-word
bind --preset $argv alt-\< beginning-of-buffer
bind --preset $argv alt-\> end-of-buffer