-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.zshrc
118 lines (94 loc) · 2.76 KB
/
.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# export
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/sbin:$PATH
# alias
alias ls='ls -F'
alias ll='ls -al'
alias la='ls -a'
alias lla='ls -la'
# history
HISTFILE=$HOME/.zsh-history
HISTSIZE=100000
SAVEHIST=100000
setopt hist_ignore_dups #同じコマンドラインを連続で実行した場合はヒストリに登録しない
setopt hist_ignore_space #スペースで始まるコマンドラインはヒストリに追加しない
setopt inc_append_history #すぐにヒストリファイルに追記する
setopt share_history #zshプロセス間でヒストリを共有する
# git
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '[%b]'
zstyle ':vcs_info:*' actionformats '[%b|%a]'
precmd () {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
function kube_ctx {
# kubectl config current-context
}
function get_face_status {
if [[ "$?" == "0" ]]; then
echo '(๑´ڡ`๑)'
return;
fi
echo '%F{red}(* ~ *)%f'
}
PROMPT='[%F{yellow}%~|%F{green}%B%n%b%f]$ '
RPROMPT='$(get_face_status) %F{cyan} %1(v|%F{gray}%1v%f|) %F{magenta}%m'
setopt prompt_subst
# alias
alias chrome='open -a /Applications/Google\ Chrome.app/'
alias gvim='open -a /Applications/MacVim.app/'
alias t="tmux"
alias v="vim"
alias g="git"
alias gg="git graph"
alias vi=vim
alias git-diff-name="git diff --name-only"
alias -g C='`git rev-parse --abbrev-ref HEAD`'
alias tigs="tig status"
# セパレータを設定する
zstyle ':completion:*' list-separator '-->'
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# Color
export CLICOLOR=1
export LSCOLORS=DxGxcxdxCxegedabagacada
# ファイル補完に色を付ける
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}¬
# http://qiita.com/items/13d150c590508d518d26
autoload -U compinit
compinit
zstyle ':completion:*:default' menu select=1
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# ssh-agent
SOCK="/tmp/ssh-agent-$USER-screen"
if test $SSH_AUTH_SOCK && [ $SSH_AUTH_SOCK != $SOCK ]
then
ln -sf $SSH_AUTH_SOCK $SOCK
export SSH_AUTH_SOCK=$SOCK
fi
fixssh() {
for key in SSH_AUTH_SOCK SSH_CONNECTION SSH_CLIENT; do
if (tmux show-environment | grep "^${key}" > /dev/null); then
value=`tmux show-environment | grep "^${key}" | sed -e "s/^[A-Z_]*=//"`
export ${key}="${value}"
fi
done
}
# git-complete
fpath=(~/.zsh/completion $fpath)
npmbin(){[ $# -ne 0 ] && $(npm bin)/$*}
git() {
local cmd=$1
if [[ $cmd == "checkout" ]]; then
echo "Use git switch/restore"
return
fi
/usr/bin/git $@
}
# k8s config
# if [ /usr/local/bin/kubectl ]; then source <(kubectl completion zsh); fi
# For Elixir/Erlang
export ERL_AFLAGS="-kernel shell_history enabled"
###### END FOR COMMON SETTING