-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
124 lines (104 loc) · 2.54 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
# Emacs keybind
bindkey -e
setopt extended_history
setopt share_history
setopt auto_pushd
setopt pushd_ignore_dups
setopt hist_ignore_dups
setopt inc_append_history
setopt auto_cd
setopt beep
setopt extended_glob
setopt nomatch
setopt no_complete_aliases
unsetopt append_history
unsetopt notify
# Remove duplicated path.
typeset -U path PATH
HISTFILE=~/.zsh_history
HISTSIZE=50000
SAVEHIST=50000
# Completion
zstyle :compinstall filename '/Users/furu/.zshrc'
autoload -Uz compinit promptinit
compinit
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}'
# Prompt
autoload -Uz colors
colors
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '[%b]'
zstyle ':vcs_info:*' actionformats '[%b|%a]'
precmd() {
psvar=()
vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
PROMPT="
%{$fg[cyan]%}%~ %1(v|%F{green}%1v%f|)
%{$fg_bold[red]%}➜ %{$reset_color%}"
# Pretty print PATH
p() {
echo ${PATH} | tr : \\n
}
# Last emerge --sync
last_synced() {
genlop --rsync | tail -n 2
}
# \ ramen timer !!! / テーレッテレー ( thx id:nkgt_chkonk )
ramen() {
sleep 180 && say -v Zarvox ramen de ki ta yo
}
# everyone say 'hi'. ( thx @eielh )
hi() {
for voice in `say -v '?' | cut -f1 -d ' '`; do echo $voice; say -v $voice hi; done
}
# https://github.com/peco/peco/wiki/Sample-Usage#pecoghq--ghq--peco-miyagawa
peco-ghq() {
cd $(ghq list --full-path | perl -nlpe 's[.*src/(.*)][$1\0$_]' | peco --null)
}
# Aliases
# http://qiita.com/items/a7807e3bac5a30791566
alias reload='exec zsh --login'
alias udon='emerge --ask --update --deep --newuse --tree world'
alias be='bundle exec'
alias ls='ls --color=auto -F'
alias l='ls --color=auto -F'
alias ll='ls -l'
alias la='ls -a'
alias lla='ls -la'
alias grep='grep --color=auto'
alias cp='cp -irp'
alias chou='echo "Execute \"sudo pacman -Syu\""; sudo pacman -Syu'
alias g='git'
alias gl='peco-ghq'
# For R Programming Language
disable r
WORDCHARS=${WORDCHARS/\//}
# Source local zshrc
[ -e ~/.zshrc.local ] && source ~/.zshrc.local
# Replacement of zsh bck-i-search
if type peco > /dev/null; then
peco-select-history() {
local tac
if type tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(history -n 1 | eval $tac | peco --query "$LBUFFER")
CUSOR=$#BUFFER
zle -R -c
}
zle -N peco-select-history
bindkey '^r' peco-select-history
fi
# Start tmux
if type tmux > /dev/null 2>&1 && [ -z "${TMUX}" ]; then
if tmux has-session > /dev/null 2>&1; then
tmux -2 attach
elif; then
tmux -2
fi
fi