-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
186 lines (150 loc) · 5.7 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
#
# Exports
#
typeset -A ZINIT
ZINIT[ZCOMPDUMP_PATH]="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompdump"
export HISTSIZE=290000 SAVEHIST=290000 HISTFILE=~/.zhistory
export WORDCHARS='*?_-.[]~&;!#$%^(){}<>'
export EDITOR='nano' VISUAL='nano' PAGER='less'
export LESS='-F -g -i -M -R -S -w -X -z-4 -j10'
export LESS_TERMCAP_mb=$'\E[01;31m' # Begins blinking.
export LESS_TERMCAP_md=$'\E[01;31m' # Begins bold.
export LESS_TERMCAP_me=$'\E[0m' # Ends mode.
export LESS_TERMCAP_se=$'\E[0m' # Ends standout-mode.
export LESS_TERMCAP_so=$'\E[00;47;30m' # Begins standout-mode.
export LESS_TERMCAP_ue=$'\E[0m' # Ends underline.
export LESS_TERMCAP_us=$'\E[01;32m' # Begins underline.
export GOPATH=$HOME/.go
if (( $#commands[(i)lesspipe(|.sh)] )); then
export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-"
fi
if [[ -z "$LANG" ]]; then
export LANG='ja_JP.UTF-8'
fi
typeset -gU cdpath fpath mailpath path
path=(
$HOME/bin(N)
$HOME/.go/bin(N)
/usr/local/{bin,sbin}(N)
$path
)
#
# Setopts
#
setopt EXTENDED_HISTORY SHARE_HISTORY HIST_EXPIRE_DUPS_FIRST HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS HIST_FIND_NO_DUPS HIST_IGNORE_SPACE HIST_SAVE_NO_DUPS
setopt HIST_VERIFY HIST_BEEP
setopt COMBINING_CHARS INTERACTIVE_COMMENTS RC_QUOTES
unsetopt MAIL_WARNING
setopt AUTO_CD AUTO_PUSHD PUSHD_IGNORE_DUPS PUSHD_SILENT PUSHD_TO_HOME
setopt EXTENDED_GLOB
unsetopt CLOBBER # Do not overwrite existing files with > and >>.
# Use >! and >>! to bypass.
setopt COMPLETE_IN_WORD ALWAYS_TO_END PATH_DIRS AUTO_MENU AUTO_LIST
setopt AUTO_PARAM_SLASH EXTENDED_GLOB NO_BEEP
unsetopt MENU_COMPLETE FLOW_CONTROL
#
# Bindkeys
#
#
# Autoloads
#
autoload -Uz bracketed-paste-url-magic
zle -N bracketed-paste bracketed-paste-url-magic
#
# Aliases
#
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
alias ls='exa --time-style=iso --color=always --icons'
alias l='ls -1a' # in one column, hidden files.
alias ll='ls -l' # in long view.
alias lT='ll -T' # in long tree view.
alias lr='ll -R' # in long view, recursively.
alias la='ll -a' # in long view, hidden files.
alias lm='la | "$PAGER"' # in long view, hidden files through pager.
alias lx='ll -h -s=ext' # sorted by extension.
alias lk='ll -h -s=size' # sorted by size, largest last.
alias lt='ll -h -umU -s=mod' # sorted by modified date, most recent last.
alias lc='lt -h -umU -s=cr' # sorted by created(changed) date, most recent last.
alias lu='lt -h -umU -s=acc' # sorted by accessed date, most recent last.
alias sl='ls' # I often screw this up.
alias d='dirs -v'
for index ({1..9}) alias "$index"="cd +${index}"; unset index
#
# Zinit
#
[[ ! -f ~/.local/share/zinit/zinit.git/zinit.zsh ]] && {
command mkdir -p ~/.local/share/zinit/zinit.git
command git clone https://github.com/zdharma-continuum/zinit.git ~/.local/share/zinit/zinit.git
}
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
zinit light-mode for \
zdharma-continuum/z-a-as-monitor \
zdharma-continuum/z-a-patch-dl \
zdharma-continuum/z-a-submods \
zdharma-continuum/z-a-bin-gem-node \
zdharma-continuum/z-a-rust
# Fast-syntax-highlighting & autosuggestions & completions
zinit wait lucid for \
atinit'zicompinit; zicdreplay' \
zdharma-continuum/fast-syntax-highlighting \
atload'_zsh_autosuggest_start' \
zsh-users/zsh-autosuggestions \
blockf atpull'zinit creinstall -q .' \
zsh-users/zsh-completions
# A few wait'1 plugins
zinit wait'1' lucid for \
atinit'zstyle ":history-search-multi-word" page-size "11"' \
zdharma-continuum/history-search-multi-word \
# prompt
eval "$(starship init zsh)"
# Prezto
zinit wait lucid is-snippet for \
PZTM::terminal \
PZTM::gnu-utility
# PZTM::utility
# PZTM::completion
# PZTM::homebrew
# PZTM::git
# zstyle ':prezto:*:*' color 'yes'
zstyle ':prezto:module:terminal' auto-title 'yes'
zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s'
zstyle ':prezto:module:terminal:tab-title' format '%m: %s'
zstyle ':prezto:module:terminal:multiplexer-title' format '%s'
# zinit ice wait"1" lucid submods'zsh-users/zsh-history-substring-search -> external'
# zinit snippet PZTM::history-substring-search # depend on module/editor
zinit wait lucid is-snippet as"completion" for \
OMZP::docker/_docker \
OMZP::docker-compose/_docker-compose
#
# Zstyles
#
zstyle ':completion::complete:*' use-cache on
zstyle ':completion::complete:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompcache"
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
unsetopt CASE_GLOB
zstyle ':completion:*:*:*:*:*' menu select=2
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'
zstyle ':completion:*:corrections' format ' %F{green}-- %d (errors: %e) --%f'
zstyle ':completion:*:descriptions' format ' %F{yellow}-- %d --%f'
zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f'
zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
zstyle ':completion:*' format ' %F{yellow}-- %d --%f'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' verbose yes
# ========================================================================
# ### prezto/runcoms/zprofile
# # Browser
# if [[ "$OSTYPE" == darwin* ]]; then
# export BROWSER='open'
# fi
# ### anyframe
# zinit light mollifier/anyframe
# bindkey '^xg' anyframe-widget-cd-ghq-repository
# bindkey '^xr' anyframe-widget-execute-history
eval "$(anyenv init -)"