From f62e3c95c692e3f1a372cb8325865d1cba37f7b1 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Mon, 14 Feb 2022 23:10:34 +0500 Subject: [PATCH] Fix tmux window naming when SSHing and fix Darwin/arm64 completions loading. --- zsh/11-autocomplete.zsh | 7 ++++++- zsh/aliases/50-ssh.conf | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/zsh/11-autocomplete.zsh b/zsh/11-autocomplete.zsh index 96f159b..991193f 100644 --- a/zsh/11-autocomplete.zsh +++ b/zsh/11-autocomplete.zsh @@ -1,6 +1,11 @@ +# Mac related - ensure that homebrew path on arm64 is added to fpath, +# otherwise autocompletions from installed packages won't work. +if [ "${OS}" = "Darwin" ] && [ "${OS_ARCH}" = "arm64" ]; then + export fpath=(${fpath} /opt/homebrew/share/zsh/site-functions) +fi + autoload -Uz compinit compinit zstyle ':completion:*' menu select=2 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' - diff --git a/zsh/aliases/50-ssh.conf b/zsh/aliases/50-ssh.conf index 6d91471..f3c0a4c 100644 --- a/zsh/aliases/50-ssh.conf +++ b/zsh/aliases/50-ssh.conf @@ -2,9 +2,9 @@ # and modified to set also "ssh" prefix. ssh() { if [ -n "$TMUX" ]; then - tmux -2u rename-window "ssh $(echo $* | rev | cut -d '@' -f1 | rev)"; - command ssh "$@"; - tmux -2u set-window-option automatic-rename "on" > /dev/null; + tmux -2u rename-window "ssh $(echo $* | rev | cut -d '@' -f1 | rev)" + command ssh "$@" + tmux -2u set-window-option automatic-rename "on" > /dev/null else command ssh "$@"; fi