-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
162 lines (134 loc) · 3.82 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
export LANG=ja_JP.UTF-8
export EDITOR=vi
export XDG_CONFIG_HOME="$HOME/.config"
bindkey -e
# 補完
autoload -Uz compinit
compinit
# 大小文字を区別しない
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# ディレクトリ名だけでcdする。
setopt auto_cd
# ディレクトリが変わったらディレクトリスタックを表示。
chpwd_functions=($chpwd_functions dirs)
# '#' 以降をコメントとして扱う
setopt interactive_comments
setopt correct
setopt nolistbeep
# git
setopt prompt_subst
autoload -Uz vcs_info
autoload -Uz add-zsh-hook
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats '(%b)%m'
zstyle ':vcs_info:*' actionformats '(%b|%a)'
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%r'
zstyle ':vcs_info:git*+set-message:*' hooks git-stash
add-zsh-hook precmd () { vcs_info }
function +vi-git-stash() {
local -a stashes
if [[ -s ${hook_com[base]}/.git/refs/stash ]] ; then
stashes=$(git stash list 2>/dev/null | wc -l | tr -d ' ')
hook_com[misc]+="%F{197}[${stashes} stashed]%f"
fi
}
# prompt
autoload -Uz colors
colors
ICON=$'\uf061 '
PROMPT='%B%F{119}${ICON}%b%f%B%F{209}${vcs_info_msg_0_}%b%f '
RPROMPT='[%F{119}%~%f]'
# apt-getとかdpkgコマンドをキャッシュを使って速くする
zstyle ':completion:*' use-cache true
# 補完候補をハイライト
zstyle ':completion:*:default' menu select=1
# colors
zstyle ':completion:*' list-colors 'di=36' 'ln=35' 'so=32' 'ex=31' 'bd=46;36' 'cd=43;36'
# history
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_NO_STORE
setopt HIST_REDUCE_BLANKS
setopt SHARE_HISTORY
# history search
bindkey '^P' history-beginning-search-backward
bindkey '^N' history-beginning-search-forward
alias vi=nvim
alias -g G='| grep'
# man
export MANPAGER='less -R'
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
# zellij
eval "$(zellij setup --generate-auto-start zsh)"
# eza
export FPATH="${HOME}/.cargo/bin/eza/completions/zsh:$FPATH"
if [ -x "$(command -v eza)" ]; then
alias ls='eza --icons --group-directories-first'
fi
# z.lua
eval "$(lua /usr/local/share/z.lua/z.lua --init zsh)"
# ruby
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
alias be="bundle exec"
# postgresql
export PGDATA="/usr/local/var/postgres"
### Added by the Heroku Toolbelt
export PATH="/usr/local/bin/heroku:$PATH"
# go
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
# rust
source $HOME/.cargo/env
# fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPTS="--layout=reverse --height 60% --inline-info"
function fzf-select-history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(history -n 1 | eval $tac | fzf --no-sort --query "$LBUFFER")
CURSOR=$#BUFFER
zle reset-prompt
}
zle -N fzf-select-history
bindkey '^r' fzf-select-history
# ghq + fzf
function ghq-fzf() {
local repo=$(ghq list | fzf --preview "ls $(ghq root)/{}" --query "$LBUFFER")
if [ -n "$repo" ]; then
BUFFER="cd $(ghq root)/$repo"
zle accept-line
fi
zle reset-prompt
}
zle -N ghq-fzf
bindkey '^]' ghq-fzf
export PATH=$PATH:$HOME/Library/Android/sdk/platform-tools
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
# github access token
export HOMEBREW_GITHUB_API_TOKEN=$HOME/.homebrew_github_api_token
# python
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"