-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.zshrc
154 lines (134 loc) · 4.63 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
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git*' formats "(%b)"
autoload -Uz promptinit; promptinit -u
precmd() {
vcs_info
}
RPROMPT=
PROMPT='%B%F{44}%m%f%b %B%F{240}%2~%f%b %B%F{216}${vcs_info_msg_0_}%f%b %# '
# History
setopt hist_ignore_all_dups
setopt inc_append_history
# Completion
fpath=(~/.zsh/completion /usr/local/share/zsh/site-functions $fpath)
autoload -Uz compinit
if [[ -n $HOME/.zcompdump(#qN.mh+72) ]]; then # use cache if updated within 72h
compinit -d $HOME/.zcompdump;
else
compinit -C;
fi
setopt nobanghist # allow unescaped ! in arguments
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' # case-insensitive completion
zstyle ':completion:*:*:vim:*:*files' ignored-patterns '(*.class|*.out|*.o)' # ignore these files from vim completion
zstyle -e ':completion::*:*:*:hosts' hosts 'reply=(${=${${(f)"$(cat $HOME/.ssh/known_hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' # ssh completion for hosts file
zstyle ':completion:*' list-suffixes
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*:*:git:*' script ~/.zsh/completion/bash/git-completion.bash
bindkey '^[[Z' reverse-menu-complete
bindkey '^R' history-incremental-search-backward
bindkey '^F' history-incremental-search-forward
compdef mosh=ssh # mosh completes like ssh
# Various
setopt autocd autopushd pushdminus pushdsilent pushdtohome cdablevars
DIRSTACKSIZE=5
setopt extendedglob
unsetopt nomatch # allow [, ]
disable r # r is a built-in for replaying command, use !!
bindkey -e
bindkey '\e\e[C' forward-word
bindkey '\e\e[D' backward-word
# Aliases
alias be='bundle exec'
alias clbin="curl -F 'clbin=<-' https://clbin.com"
alias coverage-web="ruby -run -e httpd coverage -p 3005"
alias cp='cp -Rv' # recursive and prints file names
alias dev='bin/dev' # Rails 7+ foreman launcher
alias dog="pygmentize -g"
alias egrep='egrep --color -n'
alias fetch-all='for i in `/bin/ls`; do cd $i; echo "Fetching and pruning $i"; git fap -q; cd ..; done'
alias gdb='gdb -q' # launch without license noise
alias goodcop='rubocop -Pfs' # parallelize, format=simple
alias grep='grep --color -n'
alias less='less -R' # fix non-ansi colors
alias ls='ls -lGhF --color=always' # long list, no groups, readable size, file type indicator, always color
alias mv='mv -v' # list files
alias ps='ps aux --forest' # pretty print w tree
alias pull-all='for i in `/bin/ls`; do cd $i; echo "Pulling $i"; git pull -q; cd ..; done'
alias search='grep --color -R -C3 -n' # color even when piping into less
alias strings='strings -a'
alias vi='vim -p'
alias vim='vim -p'
# tmux
alias tmux='tmux -2 -u'
# Javascript
alias jsc="env NODE_NO_READLINE=1 rlwrap node"
# Linux specific
if [[ $(uname -s) == "Linux" ]];
then
alias apt='sudo apt'
alias aptitude='sudo aptitude'
alias apt-get='sudo apt-get'
alias ifconfig='sudo ifconfig'
alias open='xdg-open'
fi
# OSX specific
if [[ $(uname -s) == "Darwin" ]];
then
unalias ps
alias brew-restart='brew services restart'
alias brew-start='brew services start'
alias brew-stop='brew services stop'
alias brew-update='brew update; brew upgrade; brew services cleanup; brew doctor; brew cleanup'
# recursive, preserve times, verbose, update (only if change time greater)
alias sync-music='rsync -rtvu --delete "/Users/kirk/Music/iTunes/iTunes Media/Music/" /Volumes/xtc/media/Music/'
alias md5sum='md5 -q'
alias ls='ls -Goh' # colorized, user but no group info, human readable file sizes
# vscode
if [[ -d "/Applications/Visual Studio Code.app" ]];
then
export PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH"
fi
fi
# Add bin to PATH
if [[ -z $TMUX && -d $HOME/bin ]];
then
export PATH=$HOME/bin:$PATH
fi
# Add homebrew sbin to PATH
if [[ -z $TMUX && -d /usr/local/sbin ]];
then
export PATH=/usr/local/sbin:$PATH
fi
# Add homebrew curl to PATH
if [[ -z $TMUX && -d /usr/local/opt/curl/bin ]];
then
export PATH=/usr/local/opt/curl/bin:$PATH
fi
# fuzzy finder
if [[ -f ~/.fzf.zsh ]];
then
source ~/.fzf.zsh
fi
# nvm
if [[ -d ~/.nvm ]];
then
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
fi
# Per-machine settings
if [[ -z $TMUX && -f $HOME/.zshlocal ]];
then
source $HOME/.zshlocal
fi
# rvm
if [[ -d $HOME/.rvm ]];
then
if [[ -z $TMUX ]];
then
export PATH="$HOME/.rvm/bin:$PATH"
fi
source "$HOME/.rvm/scripts/rvm"
fi