drop config for centos 7
[dotFiles.git] / .zshrc
blobb4a20ebea47f705042aa7be971ce3296d54baa40
1 #!/usr/bin/env zsh
3 # Turn off all beeps
4 unsetopt BEEP
5 # Turn off autocomplete beeps
6 unsetopt LIST_BEEP
8 # Search history with up and down key
9 autoload -U history-search-end
10 zle -N history-beginning-search-backward-end history-search-end
11 zle -N history-beginning-search-forward-end history-search-end
12 bindkey "\e[A" history-beginning-search-backward
13 bindkey "\e[B" history-beginning-search-forward
15 # need zsh-completions
16 zstyle ':completion:*' rehash true
17 zstyle ':completion:*:ssh:*' hosts on
18 zstyle ':completion:*' menu select=2
19 zstyle ':completion::complete:*' gain-privileges 1
20 zstyle ":completion:*" auto-description "specify: %d"
21 zstyle ":completion:*:default" list-colors ${(s.:.)LS_COLORS}
22 zstyle ":completion:*" list-colors ""
24 autoload -Uz compinit && compinit
25 autoload -Uz promptinit && promptinit
26 autoload -Uz colors && colors
28 #setopt COMPLETE_ALIASES
29 setopt completealiases
30 #setopt correctall
31 setopt extendedglob
32 setopt hist_ignore_all_dups
33 setopt hist_ignore_space
34 setopt sharehistory
37 # git plugin, require CommandLineTools or Xcode.app
38 if [ -d $(xcode-select -p)/usr/share/git-core ]; then
39 setopt promptsubst
40 setopt NO_NOMATCH
41 source $(xcode-select -p)/usr/share/git-core/git-prompt.sh
42 export GIT_PS1_SHOWDIRTYSTATE=1i
43 export GIT_PS1_SHOWSTASHSTATE=1
44 export GIT_PS1_SHOWUNTRACKEDFILES=1
47 git_ps1() { command git branch >/dev/null 2>&1 && __git_ps1; }
49 # prompt
50 #export PS1='%F{7}%*%f %F{6}%m:%~%f%F{2}$(git_ps1)%f %F{6}$%f '
51 #export PS1='%F{7}%*%f %F{6}%m:%~%f%F{2}$(case $- in (*l*) git_ps1; esac)%f %F{6}$%f '
52 export PS1='%F{7}%*%f %F{6}%m:%~%f%F{2}$([[ -o login ]] && git_ps1)%f %F{6}$%f '
54 ttyctl -f
56 [[ -f ~/.bash_alias ]] && . ~/.bash_alias
60 # GPG_TTY
61 if hash gpg-agent 2>/dev/null; then
62 export GPG_TTY=$(tty)
64 # gpgconf
65 if hash gpgconf 2>/dev/null; then
66 unset SSH_AGENT_PID
67 if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
68 export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
73 # run ccal
74 #if [[ "$(tput colors)" == 256 ]]; then
75 # hash ccal 2>/dev/null && ccal -u
76 #fi
79 # `ssh remote tmux` will try to attach remote's tmux session or
80 # create a new remote's tmux session.
81 # `ssh remote` do the regular connection.
82 #function ssh() {
83 # local _sshpath=$(which -a ssh| sed -n '$p')
84 # if [[ $@ =~ tmux ]]; then
85 # $_sshpath -C -t ${@%%tmux} "tmux attach >/dev/null 2>&1 || tmux new";
86 # else
87 # $_sshpath -C $@;
88 # fi