summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zsh/.zshrc80
1 files changed, 41 insertions, 39 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc
index e50111f..3cba947 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -12,9 +12,16 @@ promptinit
HISTFILE=~/.zshistory
HISTSIZE=1000
SAVEHIST=1000
+MAILCHECK=0 # uberspace
+LISTMAX=0
setopt completealiases
+setopt complete_in_word
setopt no_multios
+setopt nobgnice
+setopt inc_append_history
+setopt share_history
+setopt no_beep
bindkey -v
bindkey '^R' history-incremental-search-backward
@@ -29,10 +36,9 @@ zstyle '*' hosts # do not use /etc/hosts
ZDIR=~/.zsh/
_HOST_TYPE=$(uname)
-HOSTNAME=$(hostname -f 2>/dev/null)
-if [[ $? == 0 ]]; then
-else
- HOSTNAME=$(hostname)
+_HOSTNAME=$(timeout --preserve-status 0.1 hostname -f 2>/dev/null)
+if [[ $? != 0 ]]; then
+ _HOSTNAME=$HOST # $HOST is set by zsh
fi
# #############################################################################
@@ -47,16 +53,19 @@ function start_agent {
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
- /usr/bin/ssh-add;
+ /usr/bin/ssh-add
}
-if [ -f "${SSH_ENV}" ]; then
- . "${SSH_ENV}" > /dev/null
- ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
- start_agent;
- }
-else
+
+if [[ $(whoami) != "root" ]]; then
+ if [ -f "${SSH_ENV}" ]; then
+ . "${SSH_ENV}" > /dev/null
+ ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
+ start_agent
+ }
+ else
start_agent;
+ fi
fi
# #############################################################################
@@ -120,7 +129,7 @@ on_gcloud () {
}
on_aws () {
- if [[ $(echo $HOSTNAME | cut -d. -f 2) == "ec2" ]]; then
+ if [[ $(echo $_HOSTNAME | cut -d. -f 2) == "ec2" ]]; then
echo "yes"
else
echo "no"
@@ -233,29 +242,29 @@ stty -ixon # enable mapping of C-s in vim..
autoload -U colors && colors
# possible colors: black, white, green, cyan, red, yellow, magenta
-case $HOSTNAME in
- *.local|barkley*|bogues*|carter*|durant*|harden*|james*|ming*|mutombo*|nash*|oneal*|robinson*)
- HOSTCOLOR_BG=magenta
- HOSTCOLOR_FG=black
+case $_HOSTNAME in
+ *.home|barkley*|bogues*|carter*|durant*|harden*|james*|ming*|mutombo*|nash*|oneal*|robinson*)
+ _HOSTCOLOR_BG=magenta
+ _HOSTCOLOR_FG=black
;;
*.uberspace.de|*.in-berlin.de|*-hdh)
- HOSTCOLOR_BG=green
- HOSTCOLOR_FG=black
+ _HOSTCOLOR_BG=green
+ _HOSTCOLOR_FG=black
alias tmux="tmux -f ~/.tmux/uberspace.conf"
;;
*)
- HOSTCOLOR_BG=black
- HOSTCOLOR_FG=white
+ _HOSTCOLOR_BG=black
+ _HOSTCOLOR_FG=white
alias tmux="tmux -f ~/.tmux/default.conf"
# google cloud
if [[ $(on_gcloud) == "yes" ]]; then
- HOSTCOLOR_BG=blue
- HOSTCOLOR_FG=white
+ _HOSTCOLOR_BG=blue
+ _HOSTCOLOR_FG=white
alias tmux="tmux -f ~/.tmux/gcloud.conf"
# aws
elif [[ $(on_aws) == "yes" ]]; then
- HOSTCOLOR_BG=yellow
- HOSTCOLOR_FG=black
+ _HOSTCOLOR_BG=yellow
+ _HOSTCOLOR_FG=black
alias tmux="tmux -f ~/.tmux/aws.conf"
fi
;;
@@ -283,7 +292,7 @@ case `whoami` in
PROMPT="%{$bg[red]%}%{$fg[black]%}%m:%1v#%{$reset_color%} "
;;
*)
- PROMPT="%{$bg[$HOSTCOLOR_BG]%}%{$fg[$HOSTCOLOR_FG]%}%m%{$reset_color%}:%1v> "
+ PROMPT="%{$bg[$_HOSTCOLOR_BG]%}%{$fg[$_HOSTCOLOR_FG]%}%m%{$reset_color%}:%1v> "
;;
esac
@@ -330,11 +339,10 @@ alias py='bpython'
alias vi=$EDITOR
alias jsonlint='python -mjson.tool'
alias jpegtran='jpegtran -trim'
-
alias pdfmerge='gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=/tmp/merged.pdf -dBATCH'
alias thumb='convert -resize 200x200'
-
alias radio='mocp ~/.moc/radio.m3u'
+alias t_timeline='while true; do clear; t timeline -n 16 -C icon; sleep 600; done'
alias muxn='tmux new -s'
alias muxl='tmux list-sessions'
@@ -344,22 +352,17 @@ alias easy_install_home='easy_install --install-dir=$HOME/.local/lib/python/site
alias pip_install_home='pip install --prefix $HOME/.local'
alias npm_install_home='npm install -g --prefix ~/.local/lib/node'
alias gem_install_home='gem install --install-dir=$HOME/.local/lib/ruby --bindir=$HOME/.local/bin'
-alias castnow_home='castnow --myip 192.168.0.100 --address 192.168.0.4'
-
-alias my_ip='echo "$(curl 'https://api.ipify.org' 2>/dev/null)"'
-
-alias t_timeline='while true; do clear; t timeline -n 16 -C icon; sleep 600; done'
-
-alias nnn='NNN_VISUAL=1 nnn'
if [[ $_HOST_TYPE == "Linux" ]]; then
alias cal='while true; do clear; echo; khal calendar; sleep 600; done'
alias wifi_list='sudo iwlist wlan0 scan'
alias always_on='xset dpms 0 0 0'
- if [[ $(hostname) == "bogues" ]]; then
- alias vgaoff='xrandr --output VGA1 --off && xrandr --output LVDS1 --mode 1024x768'
- alias vgaclone='xrandr --output VGA1 --mode 1024x768'
- fi
+ case $_HOSTNAME in
+ bogues*)
+ alias vgaoff='xrandr --output VGA1 --off && xrandr --output LVDS1 --mode 1024x768'
+ alias vgaclone='xrandr --output VGA1 --mode 1024x768'
+ ;;
+ esac
alias vgaext='xrandr --output VGA1 --mode 1024x768 --left-of LVDS1 --rotate right'
alias vga21='xrandr --output VGA1 --mode 1600x1200 --rate 60 --rotate right && xrandr --output LVDS1 --off'
alias vga22w='xrandr --output VGA1 --mode 1680x1050 --rate 60 --rotate left && xrandr --output LVDS1 --off'
@@ -370,4 +373,3 @@ if [[ $_HOST_TYPE == "Linux" ]]; then
alias lp8p='/usr/bin/lp -o sides=two-sided-short-edge -o number-up=4 -o landscape'
alias lpimg='/usr/bin/lp -o fit-to-page'
fi
-