/
.zshrc
executable file
·172 lines (133 loc) · 4.2 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# prompt
autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:git:*' unstagedstr '!'
zstyle ':vcs_info:git:*' stagedstr '+'
zstyle ':vcs_info:*' formats ' %c%u(%s:%b)'
zstyle ':vcs_info:*' actionformats ' %c%u(%s:%b|%a)'
precmd () {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
PROMPT=$'%B%F{green}❯❯%1(v|%1v|)%f%b %B%F{blue}%~%f%b
%{\e[38;5;240m%}%n@%m%(!.#.$) %{\e[m%}'
# command history
HISTFILE=$HOME/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
PATH="${PATH}:~/bin"
# auto completion
autoload -U compinit
compinit
# not ask too many completion
LISTMAX=1000
# case insentive completion
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# completion with sudo
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
# autocd
setopt autocd
# ignore duplicate in history
setopt hist_ignore_all_dups
# ignore begin with space
setopt hist_ignore_space
# edit before run when use history
setopt hist_verify
# reduce blanks in history
setopt hist_reduce_blanks
# not store `history` command in history
setopt hist_no_store
# completion with history
setopt hist_expand
# increment append to history
setopt inc_append_history
# share history all zsh processes
setopt share_history
# if complete dir name, add trailing slash
setopt MARK_DIRS
# zsh editor
autoload zed
# editor
export EDITOR=emacs
# charset
export LANG=ja_JP.UTF-8
export KCODE=u
# alias
alias emacs=${emacsdir}\emacs
alias em="emacsclient -a '' -c"
alias emkill="emacsclient -e '(kill-emacs)'"
alias emreboot="emkill;em &"
alias emtwit="emacsclient -a '' -e '(twittering-mode)' -c &"
alias emterm="emacsclient -a '' -nw"
alias ls="ls -p"
alias la="ls -AF"
alias ll="ls -lhF"
alias lla="ls -lhAF"
alias pd="pushd"
alias ppd="popd"
alias gd='dirs -v; echo -n "select number: "; read newdir; cd +"$newdir"'
alias rezshrc="source ~/.zshrc"
alias setdisp="xrandr --output HDMI-1 --gamma 1.1:1:1 --brightness 0.88"
alias cat="bat"
# global alias
alias -g G="| grep"
alias -g H="| head"
alias -g L="| less"
alias -g T="| tail"
alias -g W="| wc"
alias -g WL="| wc -l"
# reverse completion with S-<TAB>
bindkey "^[[Z" reverse-menu-complete
# now we can use del
bindkey "^[[3~" delete-char
# config for darwin(Mac OSX)
case "${OSTYPE}" in
darwin*)
export PATH=/usr/local/opt/coreutils/libexec/gnubin:${PATH}
export MANPATH=/usr/local/opt/coreutils/libexec/gnuman:${MANPATH}
esac
stty stop undef
stty start undef
# peco
function peco-src () {
local selected_dir=$(ghq list -p | perl -nlpe 's[.*src/(.*)][$1\0$_]' | peco --null)
if [ -n "$selected_dir" ]; then
BUFFER="cd ${selected_dir}"
zle accept-line
fi
zle clear-screen
}
zle -N peco-src
bindkey '^S' peco-src
function peco-history-selection() {
BUFFER="$(history -nr 1 | awk '!a[$0]++' | peco --query "$LBUFFER" | sed 's/\\n/\n/g')"
zle clear-screen
}
zle -N peco-history-selection
bindkey '^R' peco-history-selection
# perl path
PATH="/home/nasa/perl5/bin${PATH:+:${PATH}}"; export "PATH";
PERL5LIB="/home/nasa/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="/home/nasa/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"/home/nasa/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/home/nasa/perl5"; export PERL_MM_OPT;
# go path
export GOPATH=$HOME
export PATH="$PATH:$GOPATH/bin"
export GO111MODULE=on
# Wrap git automatically by adding the following to ~/.zshrc:
eval "$(hub alias -s)"
export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"
#export GO111MODULE=on
# rust
export PATH="$HOME/.cargo/bin:$PATH"
# pip
export PATH="$HOME/Library/Python/2.7/bin:$PATH"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/JP24216/bin/google-cloud-sdk/path.zsh.inc' ]; then source '/Users/JP24216/bin/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/JP24216/bin/google-cloud-sdk/completion.zsh.inc' ]; then source '/Users/JP24216/bin/google-cloud-sdk/completion.zsh.inc'; fi
# added by travis gem
[ -f /Users/JP24216/.travis/travis.sh ] && source /Users/JP24216/.travis/travis.sh