|
|
|
@ -1,18 +1,5 @@
|
|
|
|
|
#!/bin/zsh
|
|
|
|
|
|
|
|
|
|
when_binary_available() {
|
|
|
|
|
if has_binary "$@"; then
|
|
|
|
|
printf '1'
|
|
|
|
|
return
|
|
|
|
|
fi
|
|
|
|
|
printf '0'
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
has_binary() {
|
|
|
|
|
command -v "$@" >/dev/null 2>&1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ZSH_DEBUG="${ZSH_DEBUG:-0}"
|
|
|
|
|
|
|
|
|
|
ZSH_ALIAS=${ZSH_ALIAS:-1}
|
|
|
|
@ -20,7 +7,6 @@ ZSH_COMPAT_BASH_COMPLETION=${ZSH_COMPAT_BASH_COMPLETION:-1}
|
|
|
|
|
ZSH_CUSTOM=${ZSH_CUSTOM:-1}
|
|
|
|
|
ZSH_DEFAULT_TERM=${ZSH_DEFAULT_TERM:-1}
|
|
|
|
|
ZSH_GPG_PINENTRY_FIX=${ZSH_GPG_PINENTRY_FIX:-1}
|
|
|
|
|
ZSH_PIPX=${ZSH_PIPX:-$(when_binary_available pipx)}
|
|
|
|
|
ZSH_POWERLINE="${ZSH_POWERLINE:-1}"
|
|
|
|
|
ZSH_PRINT_REBOOT_REQUIRED=${ZSH_PRINT_REBOOT_REQUIRED:-0} # hacky, see below
|
|
|
|
|
ZSH_SYNTAX_HIGHLIGHTING="${ZSH_SYNTAX_HIGHLIGHTING:-1}"
|
|
|
|
@ -62,9 +48,9 @@ log() {
|
|
|
|
|
|
|
|
|
|
# Compatibility mode for completions
|
|
|
|
|
section "compat: bash completion"
|
|
|
|
|
if [ $ZSH_COMPAT_BASH_COMPLETION -gt 0 ] || [ $ZSH_PIPX -gt 0 ]; then
|
|
|
|
|
if [ $ZSH_COMPAT_BASH_COMPLETION -gt 0 ]; then
|
|
|
|
|
log "Enabling compatibility for bash completion scripts..."
|
|
|
|
|
autoload -U bashcompinit
|
|
|
|
|
autoload bashcompinit
|
|
|
|
|
bashcompinit
|
|
|
|
|
fi
|
|
|
|
|
section_end
|
|
|
|
@ -94,13 +80,6 @@ if [ -d "$HOME/Library/Python/2.7" ]; then
|
|
|
|
|
export PATH
|
|
|
|
|
fi
|
|
|
|
|
section_end
|
|
|
|
|
section "pipx bin"
|
|
|
|
|
if [ $ZSH_PIPX -gt 0 ]; then
|
|
|
|
|
autoload -U bashcompinit
|
|
|
|
|
bashcompinit
|
|
|
|
|
eval "$(register-python-argcomplete pipx)"
|
|
|
|
|
fi
|
|
|
|
|
section_end
|
|
|
|
|
|
|
|
|
|
# Locale fix
|
|
|
|
|
section "locale fix"
|
|
|
|
@ -121,7 +100,7 @@ if [ $ZSH_POWERLINE -gt 0 ]; then
|
|
|
|
|
log "$(powerline-daemon 2>&1)"
|
|
|
|
|
|
|
|
|
|
log "Finding powerline..."
|
|
|
|
|
POWERLINE_DIR="$(pipx runpip powerline-status show powerline-status --isolated | grep '^Location:' | awk '{print $2}')"
|
|
|
|
|
POWERLINE_DIR="$(pip3 show powerline-status --isolated | grep '^Location:' | awk '{print $2}')"
|
|
|
|
|
log "Powerline repository root: $POWERLINE_DIR"
|
|
|
|
|
|
|
|
|
|
log "Preparing zstyle..."
|
|
|
|
@ -171,6 +150,7 @@ if [ $ZSH_DEFAULT_TERM -gt 0 ] && [ -z "$TERM" ]; then
|
|
|
|
|
fi
|
|
|
|
|
section_end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# gpg password via console
|
|
|
|
|
section "gpg pinentry fix"
|
|
|
|
|
if [ $ZSH_GPG_PINENTRY_FIX -gt 0 ]; then
|
|
|
|
@ -186,6 +166,7 @@ if [ $ZSH_GPG_PINENTRY_FIX -gt 0 ]; then
|
|
|
|
|
fi
|
|
|
|
|
section_end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# sugar to easily connect to remote docker hosts through SSH
|
|
|
|
|
section "ssh-based remote docker access"
|
|
|
|
|
ssh_docker() {
|
|
|
|
@ -249,6 +230,30 @@ export ssh_docker_exit
|
|
|
|
|
export ssh_docker_cleanup
|
|
|
|
|
section_end
|
|
|
|
|
|
|
|
|
|
# alias
|
|
|
|
|
section "alias"
|
|
|
|
|
if [ $ZSH_ALIAS -gt 0 ]; then
|
|
|
|
|
alias ssh-seidemannweb="ssh seiaufjt@cloud3-vm449.de-nserver.de"
|
|
|
|
|
alias ssh-pidashboard="ssh -p 10022 -L 5900:localhost:5900 ck@remote.seidemann.com"
|
|
|
|
|
alias docker-pidashboard="DOCKER_CERT_PATH=~/.docker/sw-pi-dashboard docker -H tcp://192.168.100.225:2375 --tlsverify"
|
|
|
|
|
alias docker-home="docker -H tcp://172.20.3.34:2375"
|
|
|
|
|
alias docker-winsrv2016-a="docker -H tcp://vm-winsrv2016-a:2375 --tlsverify"
|
|
|
|
|
alias wttr="curl -H 'Accept-Language: de' wttr.in/Reutlingen"
|
|
|
|
|
|
|
|
|
|
swproject() {
|
|
|
|
|
dir=$(find $HOME/src/gitlab.seidemann-web.com -type d -path "*/$1" -and -not -path '*/\.*' -print -quit)
|
|
|
|
|
if [ -z "$dir" ]; then
|
|
|
|
|
echo "Could not find project directory for $1." >&2
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
cd "$dir" || exit 1
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
export swproject
|
|
|
|
|
fi
|
|
|
|
|
section_end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Reboot required? (hacky code)
|
|
|
|
|
section "reboot required?"
|
|
|
|
|
if [ $ZSH_PRINT_REBOOT_REQUIRED -gt 0 ]; then
|
|
|
|
@ -258,6 +263,7 @@ if [ $ZSH_PRINT_REBOOT_REQUIRED -gt 0 ]; then
|
|
|
|
|
fi
|
|
|
|
|
section_end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# print env
|
|
|
|
|
section "Environment variables"
|
|
|
|
|
log "$(export)"
|
|
|
|
|