-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
125 lines (106 loc) · 3.37 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
# encoding
export LANG=ja_JP.UTF-8
# colors
autoload -U colors && colors
# completions
# for heroku completion
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
fi
# for git completion
fpath=(~/dotfiles $fpath)
autoload -Uz compinit && compinit
# for fzf completion
# fbr - checkout git branch
fbr() {
local branches branch
branches=$(git branch -vv) &&
branch=$(echo "$branches" | fzf +m) &&
git switch $(echo "$branch" | awk '{print $1}' | sed "s/.* //")
}
# fbr - checkout git branch (including remote branches)
fbrm() {
local branches branch
branches=$(git branch --all | grep -v HEAD) &&
branch=$(echo "$branches" |
fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m) &&
git switch $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##")
}
fzf-add() {
local selected
selected="$(git status -s | fzf | cut -c3-)"
if [ -n "$selected" ]; then
echo $selected
git add $selected
fi
}
alias fa="fzf-add"
# for cd completion
fd() {
local dir
dir=$(find ${1:-.} -path '*/\.*' -prune \
-o -type d -print 2> /dev/null | fzf +m) &&
cd "$dir"
}
# editor
export EDITOR=vim
# history
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt share_history
# prompt
# git-completion
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
source ~/dotfiles/.git-prompt.sh
setopt PROMPT_SUBST ; PROMPT='╭─○ %{$fg_bold[green]%}%n%{$reset_color%}:%{$fg_bold[cyan]%}%~ %{$reset_color%}$(__git_ps1 " (%s)")
╰─○ '
# aliases
alias v='vim'
alias g='git'
alias gb='git branch'
alias gs='git switch'
alias gsd='git switch develop'
alias gr='git restore'
alias gd='git diff'
alias gdh='git diff HEAD'
alias gst='git status'
alias gf='git fetch --prune'
alias gp='git pull --prune'
alias be='bundle exec'
alias ls='ls -G'
alias ll='ls -alF'
# other
setopt auto_cd
setopt auto_pushd
setopt correct
# fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# direnv
eval "$(direnv hook zsh)"
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
export PATH="/usr/local/opt/sphinx-doc/bin:$PATH"
export PATH="/usr/local/opt/libxml2/bin:$PATH"
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export PATH="/usr/local/opt/openjdk/bin:$PATH"
# export PATH="$(brew --prefix [email protected])/bin:$PATH"
export PATH="$(brew --prefix imagemagick@6)/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig"
export PATH="/usr/local/opt/m4/bin:$PATH"
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export PATH="/usr/local/opt/sqlite/bin:$PATH"
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export PATH="/usr/local/opt/krb5/bin:$PATH"
export PATH="/usr/local/opt/krb5/sbin:$PATH"
export PATH="/usr/local/opt/sphinx-doc/bin:$PATH"
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"
# Elasticsearch@6
export PATH="/usr/local/opt/elasticsearch@6/bin:$PATH"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/ymizuguchi/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/ymizuguchi/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/ymizuguchi/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/ymizuguchi/google-cloud-sdk/completion.zsh.inc'; fi