From db73778d8e02c41ee58d24a4ac0e05b3ac30fc84 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Mon, 15 Jan 2024 19:40:54 -0800 Subject: [PATCH] z4h and p10k --- .p10k.zsh | 3 ++- .zshrc | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.p10k.zsh b/.p10k.zsh index 5abce39..e705064 100644 --- a/.p10k.zsh +++ b/.p10k.zsh @@ -939,7 +939,8 @@ # Context format when in SSH without privileges: user@hostname. typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m' # Default context format (no privileges, no SSH): user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' + # typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' + typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE=%n@${${${Z4H_SSH##*:}//\%/%%}:-%m} # Don't show context unless running with privileges or in SSH. # Tip: Remove the next line to always show context. diff --git a/.zshrc b/.zshrc index 4a4c0b7..7dd35b3 100644 --- a/.zshrc +++ b/.zshrc @@ -29,7 +29,7 @@ zstyle ':z4h:autosuggestions' forward-char 'accept' # Recursively traverse directories when TAB-completing files. zstyle ':z4h:fzf-complete' recurse-dirs 'yes' -# zstyle ':z4h:fzf-complete' fzf-bindings tab:repeat +zstyle ':z4h:fzf-complete' fzf-bindings tab:repeat # Enable direnv to automatically source .envrc files. zstyle ':z4h:direnv' enable 'yes' @@ -38,11 +38,18 @@ zstyle ':z4h:direnv:success' notify 'yes' # Enable ('yes') or disable ('no') automatic teleportation of z4h over # SSH when connecting to these hosts. -zstyle ':z4h:ssh:example-hostname1' enable 'yes' -zstyle ':z4h:ssh:*.example-hostname2' enable 'no' +# zstyle ':z4h:ssh:example-hostname1' enable 'yes' +# zstyle ':z4h:ssh:*.example-hostname2' enable 'no' # The default value if none of the overrides above match the hostname. zstyle ':z4h:ssh:*' enable 'no' +zstyle ':completion:*:ssh:argument-1:' tag-order hosts users +zstyle ':completion:*:scp:argument-rest:' tag-order hosts files users +zstyle ':completion:*:(ssh|scp|rdp):*:hosts' hosts + +zstyle ':z4h:term-title:ssh' preexec '%n@'${${${Z4H_SSH##*:}//\%/%%}:-%m}': ${1//\%/%%}' +zstyle ':z4h:term-title:ssh' precmd '%n@'${${${Z4H_SSH##*:}//\%/%%}:-%m}': %~' + # Send these files over to the remote host when connecting over SSH to the # enabled hosts. # zstyle ':z4h:ssh:*' send-extra-files '~/.nanorc' '~/.env.zsh' @@ -67,7 +74,7 @@ path=(~/bin $path) export GPG_TTY=$TTY # Source additional local files if they exist. -z4h source ~/.env.zsh +z4h source ~/.local.zsh # Use additional Git repositories pulled in with `z4h install`. # @@ -116,8 +123,7 @@ alias tat='tmux new-session -As `basename $PWD | ruby -e "puts ARGF.read.strip.d alias tree='tree -a -I .git' # Add flags to existing aliases. -# alias ls="${aliases[ls]:-ls} -A" -# alias ls="${aliases[ls]:-eza} -A" +alias ls="${aliases[ls]:-ls} -A" # Set shell options: http://zsh.sourceforge.net/Doc/Release/Options.html. setopt glob_dots # no special treatment for file names with a leading dot