-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
92 lines (76 loc) · 2.05 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
# path
export PATH=$HOME/bin:$PATH
# homebrew
export HOMEBREW_DIR=/opt/homebrew
if [ ! -d $HOMEBREW_DIR ]; then
export HOMEBREW_DIR=/usr/local
fi
# terminal color
export CLICOLOR=1
# alias
alias ll='ls -l'
alias vi='vim'
# editor
export EDITOR=vim
# Golang
export GOPATH=$HOME
# nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$HOMEBREW_DIR/opt/nvm/nvm.sh" ] && \. "$HOMEBREW_DIR/opt/nvm/nvm.sh" # This loads nvm
[ -s "$HOMEBREW_DIR/opt/nvm/etc/bash_completion.d/nvm" ] && \. "$HOMEBREW_DIR/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# Keymaps
bindkey -e # Emacs mode
# peco
function peco-src () {
local selected_dir=$(ghq list --full-path | peco --query "$LBUFFER")
if [ -n "$selected_dir" ]; then
BUFFER="cd ${selected_dir}"
zle accept-line
fi
zle clear-screen
}
zle -N peco-src
bindkey '^]' peco-src
# prompt
export GIT_PS1_SHOWCOLORHINTS=1
git_prompt_sh=$HOMEBREW_DIR/etc/bash_completion.d/git-prompt.sh
if [ -e $git_prompt_sh ]; then
source $git_prompt_sh
precmd () { __git_ps1 "%F{cyan}%c%f" " $ " " (%s)" }
else
PS1='%F{cyan}%c%f \$ '
fi
# completion
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}'
zstyle ':completion:*' menu select
fpath=($HOMEBREW_DIR/share/zsh/site-functions $fpath)
autoload -U compinit
compinit -u
# history
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTSIZE=500000
SAVEHIST=500000
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_verify
setopt inc_append_history
setopt share_history
# rbenv
if [[ -d $HOME/.rbenv ]]; then
export PATH=$HOME/.rbenv/bin:$PATH
eval "$(rbenv init -)"
fi
# google-cloud-sdk
if [[ -d $HOMEBREW_DIR/Caskroom/google-cloud-sdk ]]; then
source "$(brew --prefix)/share/google-cloud-sdk/path.zsh.inc"
source "$(brew --prefix)/share/google-cloud-sdk/completion.zsh.inc"
fi
# direnv
if [ -e `which direnv` ]; then
eval "$(direnv hook zsh)"
fi
# local environment dependent settings
local_zsh=$HOME/.dotfiles/zshrc.d/local.zsh
[[ -e $local_zsh ]] && source $local_zsh