aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/shell-integration/zsh
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/zsh
parent32abb3776668ee768200019c170956f67fe33a86 (diff)
chore: update libghostty vendor
refs #276
Diffstat (limited to 'vendor/libghostty-vt/src/shell-integration/zsh')
-rw-r--r--vendor/libghostty-vt/src/shell-integration/zsh/ghostty-integration73
1 files changed, 7 insertions, 66 deletions
diff --git a/vendor/libghostty-vt/src/shell-integration/zsh/ghostty-integration b/vendor/libghostty-vt/src/shell-integration/zsh/ghostty-integration
index 76c5ce24..a96ff4bb 100644
--- a/vendor/libghostty-vt/src/shell-integration/zsh/ghostty-integration
+++ b/vendor/libghostty-vt/src/shell-integration/zsh/ghostty-integration
@@ -311,74 +311,15 @@ _ghostty_deferred_init() {
fi
# SSH Integration
+ #
+ # Wrap `ssh` with `ghostty +ssh` and translate the shell-integration
+ # feature flags into command options.
if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-* ]]; then
function ssh() {
- emulate -L zsh
- setopt local_options no_glob_subst
-
- local ssh_term ssh_opts
- ssh_term="xterm-256color"
- ssh_opts=()
-
- # Configure environment variables for remote session
- if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-env* ]]; then
- ssh_opts+=(-o "SendEnv COLORTERM TERM_PROGRAM TERM_PROGRAM_VERSION")
- fi
-
- # Install terminfo on remote host if needed
- if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-terminfo* ]]; then
- local ssh_user ssh_hostname
-
- while IFS=' ' read -r ssh_key ssh_value; do
- case "$ssh_key" in
- user) ssh_user="$ssh_value" ;;
- hostname) ssh_hostname="$ssh_value" ;;
- esac
- [[ -n "$ssh_user" && -n "$ssh_hostname" ]] && break
- done < <(command ssh -G "$@" 2>/dev/null)
-
- if [[ -n "$ssh_hostname" ]]; then
- local ssh_target="${ssh_user}@${ssh_hostname}"
-
- # Check if terminfo is already cached
- if "$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --host="$ssh_target" >/dev/null 2>&1; then
- ssh_term="xterm-ghostty"
- elif (( $+commands[infocmp] )); then
- local ssh_terminfo ssh_cpath_dir ssh_cpath
-
- ssh_terminfo=$(infocmp -0 -x xterm-ghostty 2>/dev/null)
-
- if [[ -n "$ssh_terminfo" ]]; then
- print "Setting up xterm-ghostty terminfo on $ssh_hostname..." >&2
-
- ssh_cpath_dir=$(mktemp -d "/tmp/ghostty-ssh-$ssh_user.XXXXXX" 2>/dev/null) || ssh_cpath_dir="/tmp/ghostty-ssh-$ssh_user.$$"
- ssh_cpath="$ssh_cpath_dir/socket"
-
- if builtin print -r "$ssh_terminfo" | command ssh "${ssh_opts[@]}" -o ControlMaster=yes -o ControlPath="$ssh_cpath" -o ControlPersist=60s "$@" '
- 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; then
- ssh_term="xterm-ghostty"
- ssh_opts+=(-o "ControlPath=$ssh_cpath")
-
- # Cache successful installation
- "$GHOSTTY_BIN_DIR/ghostty" +ssh-cache --add="$ssh_target" >/dev/null 2>&1 || true
- else
- print "Warning: Failed to install terminfo." >&2
- fi
- else
- print "Warning: Could not generate terminfo data." >&2
- fi
- else
- print "Warning: ghostty command not available for cache management." >&2
- fi
- fi
- fi
-
- # Execute SSH with TERM environment variable
- TERM="$ssh_term" COLORTERM=truecolor command ssh "${ssh_opts[@]}" "$@"
+ local flags=()
+ [[ "$GHOSTTY_SHELL_FEATURES" != *ssh-env* ]] && flags+=(--forward-env=false)
+ [[ "$GHOSTTY_SHELL_FEATURES" != *ssh-terminfo* ]] && flags+=(--terminfo=false)
+ "$GHOSTTY_BIN_DIR/ghostty" +ssh $flags -- "$@"
}
fi