forked from garybernhardt/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
105 lines (91 loc) · 2.78 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
# Set custom prompt
setopt PROMPT_SUBST
autoload -U promptinit
promptinit
prompt grb
# Initialize completion
autoload -U compinit
compinit
# Add paths
export PATH=/usr/local/sbin:/usr/local/bin:${PATH}
export PATH="$HOME/bin:$PATH"
# Colorize terminal
export TERM='xterm-color'
alias ls='ls -G'
alias ll='ls -lG'
export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd"
export GREP_OPTIONS="--color"
# Nicer history
export HISTSIZE=100000
export HISTFILE="$HOME/.history"
export SAVEHIST=$HISTSIZE
# Use vim as the editor
export EDITOR=vi
# GNU Screen sets -o vi if EDITOR=vi, so we have to force it back.
set -o emacs
# Use C-x C-e to edit the current command line
autoload -U edit-command-line
zle -N edit-command-line
bindkey '\C-x\C-e' edit-command-line
# By default, zsh considers many characters part of a word (e.g., _ and -).
# Narrow that down to allow easier skipping through words via M-f and M-b.
export WORDCHARS='*?[]~&;!$%^<>'
# Highlight search results in ack.
export ACK_COLOR_MATCH='red'
# Aliases
alias r="bundle exec rails"
alias t="script/test $*"
alias f="script/features $*"
function mcd() { mkdir -p $1 && cd $1 }
function cdf() { cd *$1*/ } # stolen from @topfunky
function das() {
cd ~/proj/destroyallsoftware.com/destroyallsoftware.com
pwd
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
. /Volumes/misc/filing/business/destroy\ all\ software\ llc/s3.sh
. /Volumes/misc/filing/business/destroy\ all\ software\ llc/braintree.sh
}
# Activate the closest virtualenv by looking in parent directories.
activate_virtualenv() {
if [ -f env/bin/activate ]; then . env/bin/activate;
elif [ -f ../env/bin/activate ]; then . ../env/bin/activate;
elif [ -f ../../env/bin/activate ]; then . ../../env/bin/activate;
elif [ -f ../../../env/bin/activate ]; then . ../../../env/bin/activate;
fi
}
# Find the directory of the named Python module.
python_module_dir () {
echo "$(python -c "import os.path as _, ${1}; \
print _.dirname(_.realpath(${1}.__file__[:-1]))"
)"
}
# By @ieure; copied from https://gist.github.com/1474072
#
# It finds a file, looking up through parent directories until it finds one.
# Use it like this:
#
# $ ls .tmux.conf
# ls: .tmux.conf: No such file or directory
#
# $ ls `up .tmux.conf`
# /Users/grb/.tmux.conf
#
# $ cat `up .tmux.conf`
# set -g default-terminal "screen-256color"
#
function up()
{
local DIR=$PWD
local TARGET=$1
while [ ! -e $DIR/$TARGET -a $DIR != "/" ]; do
DIR=$(dirname $DIR)
done
test $DIR != "/" && echo $DIR/$TARGET
}
# Initialize RVM
PATH=$PATH:$HOME/.rvm/bin
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"