-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
executable file
·161 lines (124 loc) · 5.17 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
# Read after $ZDOTDIR/.zshenv
###############################################################################
## Completions
# The following lines were added by compinstall
zstyle ':completion:*' completer _complete
zstyle ':completion:*' menu select=1
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle :compinstall filename '$HOME/.zshrc'
zstyle ':completion:*' list-colors ''
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# Set fpath
fpath=(${HOME}/.zsh-functions ${fpath})
autoload -U ${HOME}/.zsh-functions/*(:t)
autoload -Uz compinit
compinit
# End of lines added by compinstall
## determine in which order the names (files) should be
## listed and completed when using menu completion.
## `size' to sort them by the size of the file
## `links' to sort them by the number of links to the file
## `modification' or `time' or `date' to sort them by the last modification time
## `access' to sort them by the last access time
## `inode' or `change' to sort them by the last inode change time
## `reverse' to sort in decreasing order
## If the style is set to any other value, or is unset, files will be
## sorted by reverse access time.
## kudos to cypher (https://github.com/cypher/dotfiles/blob/master/zshrc)
zstyle ':completion:*' file-sort reverse access
## vcs_info support
## kudos http://michael-prokop.at/blog/2008/12/15/mikas-advent-calendar-day-15-zsh-vcs_info/
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' formats ' %u%c%m[%b]@%7.7i'
zstyle ':vcs_info:*' actionformats ' %u%c%m[%b|%a]@%7.7i'
zstyle ':vcs_info:*' unstagedstr '↯' # U+21AF
zstyle ':vcs_info:git*+set-message:*' hooks git-stash
precmd () {
vcs_info
git-stash
}
autoload zmv
###############################################################################
## Options
setopt APPEND_HISTORY # Append history instead of overwriting it
setopt SHARE_HISTORY # import and appended typed commands to the
# history file
setopt HIST_IGNORE_ALL_DUPS # Remove older command from history
setopt EXTENDED_HISTORY # Save timestamps
HISTSIZE=100000
SAVEHIST=100000
HISTFILE=~/.history
setopt AUTO_PUSHD # make cd push the dir to a stack
setopt PUSHD_IGNORE_DUPS # Don't push the same dir twice
DIRSTACKSIZE=10 # Max. size of the stack befor it gets
# truncated
setopt INTERACTIVE_COMMENTS # Allow comments in interactive shell
setopt PROMPT_SUBST # Turn on command substitution
unsetopt nomatch # Turn of error handling for a bad pattern
# to work around rvm.
# see https://github.com/robbyrussell/oh-my-zsh/issues/449
# Based on cypher's PROMPT (https://github.com/cypher/dotfiles/blob/master/zshrc)
autoload -U colors
colors
setopt prompt_subst
local statusprompt="%(?,%{$fg[green]%}>%{$reset_color%},%{$fg[red]%}>%{$reset_color%})"
PS1='%n@%m
%B${statusprompt}%b '
RPROMPT='%2~${vcs_info_msg_0_}'
# Report CPU usage for commands running longer than 10 seconds
# http://nuclearsquid.com/writings/reporttime-in-zsh/
REPORTTIME=10
###############################################################################
## Colors
export COLORTERM=yes
# export CLICOLOR=1
# unset LSCOLORS
# LS_COLORS='no=0:fi=0:di=32:ln=36:or=1;40:mi=1;40:pi=31:so=33:bd=44;37:cd=44;37:ex=35:*.jpg=1;32:*.jpeg=1;32:*.JPG=1;32:*.gif=1;32:*.png=1;32:*.jpeg=1;32:*.ppm=1;32:*.pgm=1;32:*.pbm=1;32:*.c=1;33:*.C=1;33:*.h=1;33:*.cc=1;33:*.awk=1;33:*.pl=1;33:*.bz2=1;35:*.gz=1;31:*.tar=1;31:*.zip=1;31:*.lha=1;31:*.lzh=1;31:*.arj=1;31:*.tgz=1;31:*.taz=1;31:*.html=1;34:*.htm=1;34:*.doc=1;34:*.txt=1;34:*.o=1;36:*.a=1;36:*.php3=1;31'
###############################################################################
## Editor
if command -v mate >/dev/null 2>&1
then
export VISUAL="mate -w"
export GIT_EDITOR="mate --name 'Git Commit Message' -w -l 1"
alias m='mate'
alias m.='mate .'
else
export VISUAL="vim -f"
fi
export EDITOR=$VISUAL
# Use emacs key bindings
bindkey -e
###############################################################################
## Alias
alias ls='ls -G'
alias ll='ls -lA'
alias la='ls -la'
alias d='dirs -v'
alias g='git'
alias o='open'
alias o.='open .'
alias x='xed'
alias x.='xed .'
alias p='bundle exec pod'
alias tx='tmuxinator'
alias python='/usr/bin/python3'
# Show current airport status
# Kudos to cypher (https://github.com/cypher/dotfiles/blob/master/zshrc)
alias apinfo='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I'
# openssl magic
alias sha1='openssl dgst -sha1'
alias sha256='openssl dgst -sha256'
alias sha512='openssl dgst -sha512'
# 'clean' Xcode DerivedData folder
alias cdd='setopt rmstarsilent;rm -rf ${HOME}/Library/Developer/Xcode/DerivedData/*;unsetopt rmstarsilent'
# Open Xcode projects and workspaces
alias -s xcodeproj="open -a Xcode"
alias -s xcworkspace="open -a Xcode"
# mob
alias ms='mob start'
alias mn='mob next'
alias md='mob done'