aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/shell-integration/fish
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-01 23:05:23 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-01 23:05:51 +0300
commit5bd21b7ed468b5ff4d1a5b2ed7e211f401eb138a (patch)
tree672fa4625cca0ecb3e9376fc7f8e33d7b0e9deef /vendor/libghostty-vt/src/shell-integration/fish
parent32abb3776668ee768200019c170956f67fe33a86 (diff)
chore: update libghostty vendor
refs #276
Diffstat (limited to 'vendor/libghostty-vt/src/shell-integration/fish')
-rw-r--r--vendor/libghostty-vt/src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish81
1 files changed, 7 insertions, 74 deletions
diff --git a/vendor/libghostty-vt/src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish b/vendor/libghostty-vt/src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish
index f8bfe091..e0360b5a 100644
--- a/vendor/libghostty-vt/src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish
+++ b/vendor/libghostty-vt/src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish
@@ -120,84 +120,17 @@ function __ghostty_setup --on-event fish_prompt -d "Setup ghostty integration"
end
# SSH Integration
+ #
+ # Wrap `ssh` with `ghostty +ssh` and translate the shell-integration
+ # feature flags into command options.
set -l features (string split ',' -- "$GHOSTTY_SHELL_FEATURES")
if contains ssh-env $features; or contains ssh-terminfo $features
function ssh --wraps=ssh --description "SSH wrapper with Ghostty integration"
set -l features (string split ',' -- "$GHOSTTY_SHELL_FEATURES")
- set -l ssh_term xterm-256color
- set -l ssh_opts
-
- # Configure environment variables for remote session
- if contains ssh-env $features
- set -a ssh_opts -o "SendEnv COLORTERM TERM_PROGRAM TERM_PROGRAM_VERSION"
- end
-
- # Install terminfo on remote host if needed
- if contains ssh-terminfo $features
- set -l ssh_user
- set -l ssh_hostname
-
- for line in (command ssh -G $argv 2>/dev/null)
- set -l parts (string split ' ' -- $line)
- if test (count $parts) -ge 2
- switch $parts[1]
- case user
- set ssh_user $parts[2]
- case hostname
- set ssh_hostname $parts[2]
- end
- if test -n "$ssh_user"; and test -n "$ssh_hostname"
- break
- end
- end
- end
-
- if test -n "$ssh_hostname"
- set -l ssh_target "$ssh_user@$ssh_hostname"
-
- # Check if terminfo is already cached
- if test -x "$GHOSTTY_BIN_DIR/ghostty"; and "$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --host="$ssh_target" >/dev/null 2>&1
- set ssh_term xterm-ghostty
- else if command -q infocmp
- set -l ssh_terminfo
- set -l ssh_cpath_dir
- set -l ssh_cpath
-
- set ssh_terminfo "$(infocmp -0 -x xterm-ghostty 2>/dev/null)"
-
- if test -n "$ssh_terminfo"
- echo "Setting up xterm-ghostty terminfo on $ssh_hostname..." >&2
-
- set ssh_cpath_dir (mktemp -d "/tmp/ghostty-ssh-$ssh_user.XXXXXX" 2>/dev/null; or echo "/tmp/ghostty-ssh-$ssh_user."(random))
- set ssh_cpath "$ssh_cpath_dir/socket"
-
- if echo "$ssh_terminfo" | command ssh $ssh_opts -o ControlMaster=yes -o ControlPath="$ssh_cpath" -o ControlPersist=60s $argv '
- infocmp xterm-ghostty >/dev/null 2>&1 && exit 0
- command -v tic >/dev/null 2>&1 || exit 1
- mkdir -p ~/.terminfo 2>/dev/null && tic -x - 2>/dev/null && exit 0
- exit 1
- ' 2>/dev/null
- set ssh_term xterm-ghostty
- set -a ssh_opts -o "ControlPath=$ssh_cpath"
-
- # Cache successful installation
- if test -x "$GHOSTTY_BIN_DIR/ghostty"
- "$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --add="$ssh_target" >/dev/null 2>&1; or true
- end
- else
- echo "Warning: Failed to install terminfo." >&2
- end
- else
- echo "Warning: Could not generate terminfo data." >&2
- end
- else
- echo "Warning: ghostty command not available for cache management." >&2
- end
- end
- end
-
- # Execute SSH with TERM environment variable
- TERM="$ssh_term" COLORTERM=truecolor command ssh $ssh_opts $argv
+ set -l flags
+ contains ssh-env $features; or set -a flags --forward-env=false
+ contains ssh-terminfo $features; or set -a flags --terminfo=false
+ "$GHOSTTY_BIN_DIR/ghostty" +ssh $flags -- $argv
end
end