Revert "Swap alt-{left,right,backspace,delete} with ctrl-* on macOS"

This reverts commit ebdc3a0393.

Not discussed, includes a new thing that queries the terminal for the client OS
when what is really needed is just a `uname` - which would also work on Terminal.app.
This commit is contained in:
Fabian Boehm
2025-01-19 18:52:10 +01:00
parent 0494b1b608
commit 98a96f5b58
8 changed files with 16 additions and 146 deletions

View File

@@ -217,13 +217,6 @@ end" >$__fish_config_dir/config.fish
end
__fish_update_cwd_osc # Run once because we might have already inherited a PWD from an old tab
if set -q TMUX
# NOTE This will be stale when the next tmux client attaches to fish's window.
# This isn't oo bad since we only use this to detect the client OS.
# TODO we should have a client scope.
set -g __fish_tmux_client_tty (tmux display-message -p '#{client_tty}' 2>/dev/null)
end
# Bump this whenever some code below needs to run once when upgrading to a new version.
# The universal variable __fish_initialized is initialized in share/config.fish.
set __fish_initialized 3800

View File

@@ -21,20 +21,8 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
$legacy_bind --preset $argv -k left backward-char
# Ctrl-left/right - these also work in vim.
bind --preset $argv ctrl-right '
if test (status client-os) = macos
commandline -f forward-token
else
commandline -f forward-word
end
'
bind --preset $argv ctrl-left '
if test (status client-os) = macos
commandline -f backward-token
else
commandline -f backward-word
end
'
bind --preset $argv ctrl-right forward-word
bind --preset $argv ctrl-left backward-word
bind --preset $argv pageup beginning-of-history
bind --preset $argv pagedown end-of-history
@@ -61,25 +49,13 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
bind --preset $argv up up-or-search
$legacy_bind --preset $argv -k up up-or-search
bind --preset $argv shift-right forward-token
bind --preset $argv shift-left backward-token
$legacy_bind --preset $argv -k sright forward-token
$legacy_bind --preset $argv -k sleft backward-token
bind --preset $argv shift-right forward-bigword
bind --preset $argv shift-left backward-bigword
$legacy_bind --preset $argv -k sright forward-bigword
$legacy_bind --preset $argv -k sleft backward-bigword
bind --preset $argv alt-right '
if test (status client-os) = macos
commandline -f nextd-or-forward-word
else
nextd-or-forward-token
end
'
bind --preset $argv alt-left '
if test (status client-os) = macos
commandline -f prevd-or-backward-word
else
prevd-or-backward-token
end
'
bind --preset $argv alt-right nextd-or-forward-token
bind --preset $argv alt-left prevd-or-backward-token
bind --preset $argv alt-up history-token-search-backward
bind --preset $argv alt-down history-token-search-forward

View File

@@ -57,34 +57,10 @@ function fish_default_key_bindings -d "emacs-like key binds"
bind --preset $argv alt-u upcase-word
bind --preset $argv alt-c capitalize-word
bind --preset $argv alt-backspace '
if test (status client-os) = macos
commandline -f backward-kill-word
else
commandline -f backward-kill-token
end
'
bind --preset $argv ctrl-backspace '
if test (status client-os) = macos
commandline -f backward-kill-token
else
commandline -f backward-kill-word
end
'
bind --preset $argv alt-delete '
if test (status client-os) = macos
commandline -f kill-word
else
commandline -f kill-token
end
'
bind --preset $argv ctrl-delete '
if test (status client-os) = macos
commandline -f kill-token
else
commandline -f kill-word
end
'
bind --preset $argv alt-backspace backward-kill-token
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