-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
249 lines (204 loc) · 6.06 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#
# zplug
#
source ~/.zplug/init.zsh
#インクリメンタル補完
zplug 'zsh-users/zsh-autosuggestions'
#標準サポート外のコマンド補完
zplug 'zsh-users/zsh-completions'
#nice は古い設定
#zplug 'zsh-users/zsh-syntax-highlighting', nice:10
#コマンドラインのシンタックス
zplug 'zsh-users/zsh-syntax-highlighting', defer:2
#anything風コマンドラインインクリメンタル検索
zplug 'mollifier/anyframe'
#zsh visual mode
zplug "b4b4r07/zsh-vimode-visual", defer:3
if ! zplug check --verbose; then
printf 'Install? [y/N]: '
if read -q; then
echo; zplug install
fi
fi
#zplug load --verbose
zplug load
#
# Autoloadings
#
autoload -Uz add-zsh-hook
autoload -Uz compinit && compinit -u
#URLを自動エスケープ
autoload -Uz url-quote-magic
#vcs_info設定
autoload -Uz vcs_info
# cdr setting
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
#PROMPT="%{${fg[blue]}%}[%~]%{${reset_color}%}"
#
# ZLE settings
#
zle -N self-insert url-quote-magic
#プロンプトに現在のモードを表示
#terminfo_down_sc=$terminfo[cud1]$terminfo[cuu1]$terminfo[sc]$terminfo[cud1]
#left_down_prompt_preexec() {
# print -rn -- $terminfo[el]
#}
#add-zsh-hook preexec left_down_prompt_preexec
#function zle-keymap-select zle-line-init zle-line-finish
#{
# case $KEYMAP in
# main|viins)
# PROMPT_2="$fg[cyan]-- INSERT --$reset_color"
# ;;
# vicmd)
# PROMPT_2="$fg[white]-- NORMAL --$reset_color"
# ;;
# vivis|vivli)
# PROMPT_2="$fg[yellow]-- VISUAL --$reset_color"
# ;;
# esac
# PROMPT="%{$terminfo_down_sc$PROMPT_2$terminfo[rc]%}[%(?.%{${fg[green]}%}.%{${fg[red]}%})%n%{${reset_color}%}]%# "
# zle reset-prompt
#}
#zle -N zle-line-init
#zle -N zle-line-finish
#zle -N zle-keymap-select
zle -N edit-command-line
#
# General settings
#
setopt auto_list
setopt auto_menu
setopt auto_pushd
setopt extended_history
setopt hist_ignore_all_dups
setopt hist_ignore_dups
setopt hist_reduce_blanks
setopt hist_save_no_dups
setopt ignore_eof
setopt inc_append_history
setopt interactive_comments
setopt no_beep
setopt no_hist_beep
setopt no_list_beep
setopt magic_equal_subst
setopt notify
setopt print_eight_bit
setopt print_exit_value
setopt prompt_subst
setopt pushd_ignore_dups
setopt rm_star_wait
setopt share_history
setopt transient_rprompt
#
# Exports
#
export CLICOLOR=true
export LSCOLORS='exfxcxdxbxGxDxabagacad'
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:'
export EDITOR=vim
export HISTFILE=~/.zhistory
export HISTSIZE=1000
export SAVEHIST=1000000
export LANG=ja_JP.UTF-8
#
# Key bindings
#
bindkey -v
bindkey -v '^?' backward-delete-char
bindkey '^[[Z' reverse-menu-complete
bindkey '^xb' anyframe-widget-cdr
bindkey '^x^b' anyframe-widget-checkout-git-branch
bindkey '^xr' anyframe-widget-execute-history
bindkey '^x^r' anyframe-widget-execute-history
bindkey '^xp' anyframe-widget-put-history
bindkey '^x^p' anyframe-widget-put-history
bindkey '^xg' anyframe-widget-cd-ghq-repository
bindkey '^x^g' anyframe-widget-cd-ghq-repository
bindkey '^xk' anyframe-widget-kill
bindkey '^x^k' anyframe-widget-kill
bindkey '^xi' anyframe-widget-insert-git-branch
bindkey '^x^i' anyframe-widget-insert-git-branch
bindkey '^xf' anyframe-widget-insert-filename
bindkey '^x^f' anyframe-widget-insert-filename
#viins をemacsのごとく利用
bindkey -M viins '\er' history-incremental-pattern-search-forward
bindkey -M viins '^?' backward-delete-char
bindkey -M viins '^A' beginning-of-line
bindkey -M viins '^B' backward-char
bindkey -M viins '^D' delete-char-or-list
bindkey -M viins '^E' end-of-line
bindkey -M viins '^F' forward-char
bindkey -M viins '^G' send-break
bindkey -M viins '^H' backward-delete-char
bindkey -M viins '^K' kill-line
bindkey -M viins '^N' down-line-or-history
bindkey -M viins '^P' up-line-or-history
bindkey -M viins '^R' history-incremental-pattern-search-backward
bindkey -M viins '^U' backward-kill-line
bindkey -M viins '^W' backward-kill-word
bindkey -M viins '^Y' yank
#
# Aliases
#
alias vi='vim'
#
# Module settings
#
# Completion
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*' group-name ''
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' use-cache true
zstyle ':completion:*' verbose yes
zstyle ':completion:*:default' menu select=2
zstyle ':completion:*:descriptions' format '%F{yellow}-- %d --%f'
zstyle ':completion:*:options' description 'yes'
#path
typeset -U path cdpath fpath manpath
typeset -xT SUDO_PATH sudo_path
typeset -U sudo_path
sudo_path=({/usr/local,/usr,}/sbin(N-/))
path=(~/bin(N-/) /usr/local/bin(N-/) ~/Library/Python/2.7/bin/ ${path})
fpath=($HOME/.zsh/anygrame(N-/) $fpath)
autoload -Uz anyframe-init
anyframe-init
#peco
function peco-history-selection() {
BUFFER=`history -n 1 | tail -r | awk '!a[$0]++' | peco`
CURSOR=$#BUFFER
zle reset-prompt
}
zle -N peco-history-selection
bindkey '^R' peco-history-selection
bindkey '^X' peco-cdr
# for powerline
powerline-daemon -q
. ~/Library/Python/2.7/lib/python/site-packages/powerline/bindings/zsh/powerline.zsh
#function rprompt-git-current-branch {
#local name st color
#if [[ "$PWD" =~ '/\.git(/.*)?$' ]]; then
# return
#fi
#name=$(basename "`git symbolic-ref HEAD 2> /dev/null`")
#if [[ -z $name ]]; then
# return
#fi
#st=`git status 2> /dev/null`
#if [[ -n `echo "$st" | grep "^nothing to"` ]]; then
# color=${fg[green]}
#elif [[ -n `echo "$st" | grep "^nothing added"` ]]; then
# color=${fg[yellow]}
#elif [[ -n `echo "$st" | grep "^# Untracked"` ]]; then
# color=${fg_bold[red]}
#else
# color=${fg[red]}
#fi
# %{...%} は囲まれた文字列がエスケープシーケンスであることを明示する
# これをしないと右プロンプトの位置がずれる
#echo "[%{$color%}$name%{$reset_color%}]"
#}
# プロンプトが表示されるたびにプロンプト文字列を評価、置換する
#setopt prompt_subst
#RPROMPT='%40<...<%~`rprompt-git-current-branch`($?)'