From 7f1cf9a54bd6887006e12579f8d6450706880fd1 Mon Sep 17 00:00:00 2001 From: hl Date: Mon, 18 Nov 2024 18:20:40 +0800 Subject: [PATCH] update --- .zshrc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.zshrc b/.zshrc index 5bef838..50e777f 100644 --- a/.zshrc +++ b/.zshrc @@ -43,7 +43,7 @@ compinit autoload -Uz promptinit promptinit -compdef sshpy=ssh +compdef pyssh=ssh export FZF_COMPLETION_TRIGGER="''" export FZF_COMPLETION_DIR_COMMANDS='cd pushd rmdir ls ll' @@ -68,21 +68,21 @@ _fzf_comprun() { shift case "$command" in - ssh|mosh|sshpy) fzf --preview 'ssh -tt -G {} | head -n 4' "$@" ;; + ssh|mosh|pyssh) fzf --preview 'ssh -tt -G {} | head -n 4' "$@" ;; cd|ls|ll) fzf --preview 'tree -C -L1 {} | head -200' "$@" ;; cat|nano) fzf --preview 'cat -s {} | head -200' "$@" ;; *) fzf "$@" ;; esac } -_fzf_complete_sshpy() { +_fzf_complete_pyssh() { _fzf_complete +m -- "$@" < <( setopt localoptions nonomatch command cat <(command tail -n +1 ~/.ssh/config ~/.ssh/config.d/* 2> /dev/null | command grep -i '^\s*host ' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}' | command grep -v '[*?%]') | awk '{if (length($2) > 0) {print $2}}' | sort -u ) } -alias _fzf_complete_mosh=_fzf_complete_sshpy -alias _fzf_complete_ssh=_fzf_complete_sshpy +alias _fzf_complete_mosh=_fzf_complete_pyssh +alias _fzf_complete_ssh=_fzf_complete_pyssh _fzf_complete_cat(){ __fzf_generic_path_completion "$prefix" "$1" __fzf_compgen_file \ "-m" "" " "