From cea68a69380210ca700166b430022cd7e609d2d1 Mon Sep 17 00:00:00 2001 From: kat witch Date: Mon, 30 Aug 2021 02:04:08 +0100 Subject: [PATCH] zsh.nix -> shell.nix for vim highlighting, added ssh autocomplete --- config/users/kat/base/default.nix | 2 +- config/users/kat/base/{zsh.nix => shell.nix} | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) rename config/users/kat/base/{zsh.nix => shell.nix} (88%) diff --git a/config/users/kat/base/default.nix b/config/users/kat/base/default.nix index ea9983e9..c7007969 100644 --- a/config/users/kat/base/default.nix +++ b/config/users/kat/base/default.nix @@ -3,7 +3,7 @@ { imports = [ ./vim - ./zsh.nix + ./shell.nix ./git.nix ./tmux.nix ./base16.nix diff --git a/config/users/kat/base/zsh.nix b/config/users/kat/base/shell.nix similarity index 88% rename from config/users/kat/base/zsh.nix rename to config/users/kat/base/shell.nix index 032c34cb..d3531e92 100644 --- a/config/users/kat/base/zsh.nix +++ b/config/users/kat/base/shell.nix @@ -59,7 +59,17 @@ in ZSH_TAB_TITLE_ADDITIONAL_TERMS='foot' ZSH_TAB_TITLE_ENABLE_FULL_COMMAND=true zmodload -i zsh/complist - zstyle ':completion:*' list-colors "" + h=() + if [[ -r ~/.ssh/config ]]; then + h=($h ''${''${''${(@M)''${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*}) + fi + if [[ -r ~/.ssh/known_hosts ]]; then + h=($h ''${''${''${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null + fi + if [[ $#h -gt 0 ]]; then + zstyle ':completion:*:ssh:*' hosts $h + zstyle ':completion:*:slogin:*' hosts $h + fi zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'