/
.zshrc
116 lines (96 loc) · 2.26 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
bindkey -e
# Load Plugins
source ~/.zsh/antigenrc
setopt ignore_eof
setopt interactive_comments
setopt no_beep
# cd関連
setopt autocd
setopt auto_pushd
setopt pushd_ignore_dups
alias b='cd ..'
# 補完関連
unsetopt auto_menu
fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit
compinit -u
# Environment variables
export TZ=Asia/Tokyo
export LANG=ja_JP.utf8
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib
export PATH=$HOME/bin:$PATH
# Aliases
alias vi='vim'
alias view='vim -R'
alias irb='pry'
alias crontab='crontab -i'
alias less='less -R'
alias ls='ls --color=auto'
alias la='ls -la'
alias ll='ls -l'
alias diff='colordiff -u'
alias grep='grep --color=auto'
alias tailf='tail -f'
# show filelist when change directory.
chpwd() {
ls -l
}
# <C-s>/<C-q>による画面更新の停止機能を無効化
stty stop undef
stty start undef
# history settings
export HISTFILE=~/.histfile
export HISTSIZE=1000000
export SAVEHIST=1000000
setopt hist_ignore_dups
setopt share_history
setopt hist_no_store
setopt hist_expand
# 入力中の内容にマッチする物のみ履歴をたどる
autoload -Uz history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^P" history-beginning-search-backward-end
bindkey "^N" history-beginning-search-forward-end
# 空Enterでgit status表示
function do_enter() {
if [ -n "$BUFFER" ]; then
zle accept-line
return 0
fi
echo
# ls
# ↓おすすめ
# ls_abbrev
if [ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" = 'true' ]; then
echo
git status -sb
fi
zle reset-prompt
return 0
}
zle -N do_enter
bindkey '^m' do_enter
# promptにgitのbranchとstatusを表示
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '[%b]'
zstyle ':vcs_info:*' actionformats '[%b|%a]'
precmd() {
psvar=()
LANG=en_US.UTF-8 vcs_info
psvar[1]=$vcs_info_msg_0_
}
PROMPT="[%n@%m]%~ %2F%1v%f%(!,#,%%) "
# Append PATH to node
export NODE_PATH=/opt/node
export PATH=$PATH:$NODE_PATH/bin
# Use pyenv
if [ -f "$PYENV_ROOT/bin/pyenv" ]; then
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
fi
# Add alias for python3
python --version 2>&1 | grep "Python 2" > /dev/null
if [ $? -eq 0 ]; then
alias python=python3
fi