1
0
mirror of https://github.com/kremalicious/dotfiles.git synced 2024-11-21 17:27:13 +01:00

zsh ssh completion

This commit is contained in:
Matthias Kretschmann 2019-10-25 00:38:46 +02:00
parent 662c3e7d29
commit 801e514d78
Signed by: m
GPG Key ID: 606EEEF3C479A91F
5 changed files with 28 additions and 36 deletions

View File

@ -23,14 +23,12 @@ brew install \
wget \ wget \
gpg \ gpg \
nvm \ nvm \
pandoc \
pinentry-mac \ pinentry-mac \
openssl \ openssl \
tor \ tor \
python \ python \
rclone \ rclone \
rsync \ rsync \
ruby \
shellcheck \ shellcheck \
ipfs \ ipfs \
clamav clamav

View File

@ -51,7 +51,7 @@ echo "$(tput setaf 64)---------------------------------------------"
echo " ✓ done$(tput sgr0)" echo " ✓ done$(tput sgr0)"
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# source what we just created # Prompt
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Switch to using brew-installed zsh as default shell # Switch to using brew-installed zsh as default shell
@ -62,9 +62,6 @@ fi;
npm i -g pure-prompt npm i -g pure-prompt
# shellcheck source=/dev/null
source "$HOME/.zshrc"
echo "$(tput setaf 64)=============================================" echo "$(tput setaf 64)============================================="
echo " ✓ all done" echo " ✓ all done"
echo "=============================================$(tput sgr0)" echo "=============================================$(tput sgr0)"

View File

@ -24,11 +24,4 @@ for FILE in $FILES; do
done done
# ----------------------------------------------------------------------
# source what we just created
# ----------------------------------------------------------------------
# shellcheck source=/dev/null
source "$HOME/.zshrc"
exit exit

View File

@ -6,7 +6,6 @@ export ARCHFLAGS="-arch x86_64"
# Prefer US English and use UTF-8 # Prefer US English and use UTF-8
export LC_ALL="en_US.UTF-8" export LC_ALL="en_US.UTF-8"
export LANG="en_US" export LANG="en_US"
#!/usr/bin/env bash
# --------------------------------------------------- # ---------------------------------------------------
# PATH # PATH
@ -32,17 +31,12 @@ NODE_GLOBALS+=("nvm")
load_nvm () { load_nvm () {
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
} }
for cmd in "${NODE_GLOBALS[@]}"; do for cmd in "${NODE_GLOBALS[@]}"; do
eval "${cmd}(){ unset -f ${NODE_GLOBALS}; load_nvm; ${cmd} \$@ }" eval "${cmd}(){ unset -f ${NODE_GLOBALS}; load_nvm; ${cmd} \$@ }"
done done
# ----
# if [ -s "$HOME/.nvm" ]; then
# export NVM_DIR="$HOME/.nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# fi
# pip should only run if there is a virtualenv currently activated # pip should only run if there is a virtualenv currently activated
#export PIP_REQUIRE_VIRTUALENV=true #export PIP_REQUIRE_VIRTUALENV=true

42
zshrc
View File

@ -6,20 +6,6 @@ PURE_GIT_DOWN_ARROW=↓
PURE_GIT_UP_ARROW= PURE_GIT_UP_ARROW=
prompt pure prompt pure
# https://gist.github.com/ctechols/ca1035271ad134841284#gistcomment-2767420
autoload -Uz compinit
setopt EXTENDEDGLOB
for dump in $ZSH_COMPDUMP(#qN.m1); do
compinit
if [[ -s "$dump" && (! -s "$dump.zwc" || "$dump" -nt "$dump.zwc") ]]; then
zcompile "$dump"
fi
echo "Initializing Completions..."
done
unsetopt EXTENDEDGLOB
compinit -C
CASE_SENSITIVE="true" CASE_SENSITIVE="true"
DISABLE_UPDATE_PROMPT="true" DISABLE_UPDATE_PROMPT="true"
DISABLE_AUTO_TITLE="true" DISABLE_AUTO_TITLE="true"
@ -53,9 +39,32 @@ zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
zstyle ':completion::complete:*' use-cache 1 zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR
zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
# Highlight the current autocomplete option
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# Better SSH/SCP/Rsync Autocomplete
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|scp|rsync|slogin):*' hosts $h
fi
# https://gist.github.com/ctechols/ca1035271ad134841284#gistcomment-2767420
autoload -Uz compinit
if [[ -n ~/.zcompdump(#qN.mh+24) ]]; then
compinit
touch ~/.zcompdump
else
compinit -C
fi
# Other # Other
setopt prompt_subst setopt prompt_subst
@ -65,5 +74,6 @@ source ~/.aliases
source ~/.private source ~/.private
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source <(kubectl completion zsh)
# zprof # zprof