-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathzshrc
executable file
·179 lines (143 loc) · 3.51 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
fpath=(~/.zsh/functions $fpath)
# ALIASES
alias .='pwd'
alias ...='cd ../..'
alias ....='cd ../../..'
alias ls='ls -FG'
alias ll='ls -FGl'
function sc() {
set -x
if [ -f ./script/console ]; then
./script/console --debugger "$@"
else
if [ -f ./bin/rails ]; then
./bin/rails console --debugger "$@"
else
rails console --debugger "$@"
fi
fi
set +x
}
function ss() {
if [ -f ./script/server ]; then
./script/server --debugger "$@"
else
if [ -f ./script/rails ]; then
./script/rails server --debugger "$@"
else
rails server --debugger "$@"
fi
fi
}
function ec2() {
local ec2_conf=~/.aws/$1/ec2.sh
local s3_conf=~/.aws/$1/s3.config
if [ -e $ec2_conf ]; then
echo "found ec2 conf $ec2_conf"
source $ec2_conf
else
echo "NOT found ec2 conf"
fi
if [ -e $s3_conf ]; then
echo "found s3 conf $s3_conf"
ln -sfn $s3_conf ~/.s3cfg
else
echo "NOT found s3 cong"
fi
}
function rake() {
if [ -e bin/rake ]; then
bin/rake "$@"
else
/usr/bin/env rake "$@"
fi
}
# COLORS
autoload colors; colors;
unset LSCOLORS
export LSCOLORS="Gxfxcxdxbxegedabagacad"
# GREP
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;32'
# HISTORY
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt hist_verify
setopt inc_append_history
setopt share_history
setopt extended_history
setopt hist_ignore_dups
# OPTIONS
export PAGER=less
export EDITOR=vim
export LC_CTYPE=en_US.UTF-8
setopt autocd
setopt auto_pushd
setopt extendedglob
setopt auto_name_dirs
setopt multios
setopt cdablevars
unsetopt beep nomatch
autoload -U select-word-style; select-word-style bash
# COMPLETION
setopt auto_menu
unsetopt menu_complete
zmodload -i zsh/complist
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
zstyle ':completion:*:*:*:*:*' menu yes select
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`
zstyle ':completion:*' insert-unambiguous true
zstyle :compinstall filename '~/.zshrc'
autoload -Uz compinit; compinit
# PROMPT
setopt prompt_subst
autoload -U promptinit; promptinit
prompt fancy
# RVM
if [[ -s /etc/profile.d/rvm.sh ]]; then
source /etc/profile.d/rvm.sh
elif [[ -s ~/.rvm/scripts/rvm ]] ;then
source ~/.rvm/scripts/rvm
elif [[ -s /usr/local/rvm/scripts/rvm ]] ;then
source /usr/local/rvm/scripts/rvm
fi
# BINDINGS
#bindkey -e
bindkey -v
# Up
bindkey "\e[A" history-search-backward
# Down
bindkey "\e[B" history-search-forward
# PgUp. Fn-Shift-Up
bindkey "\e[5~" up-line-or-history
# PgDown. Fn-Shift-Down
bindkey "\e[6~" down-line-or-history
# Esc Backspace
#bindkey "\e\b" backward-delete-word
#bindkey "\e\b" vi-backward-kill-word
# home. Fn-Shift-Left on mac
bindkey "\e[H" beginning-of-line
# end. Fn-Shift-Right on mac
bindkey "\e[F" end-of-line
# Esc .
bindkey "\e." insert-last-word
# Ctrl-A
bindkey "^A" beginning-of-line
# Ctrl-E
bindkey "^E" end-of-line
# 'v' in vi command model to edit command line
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
#bindkey "^Xh" _complete_help
if [ -e ~/.zsh/local ]; then
source ~/.zsh/local
fi
function mm() { pwd > ~/.last_dir }
function gg() { cd "`cat ~/.last_dir`" }
function chpwd { mm }
gg