-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathbashrc
103 lines (81 loc) · 2.74 KB
/
bashrc
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
source ~/.profile
# Bash customisations to be syncronised between machines.
export PS1='\[\e[1;34m\][\u@\h \W]\$\[\e[0m\] '
# History
export HISTCONTROL=erasedups # when adding an item to history, delete itentical commands upstream
export HISTSIZE=10000 # save 10000 items in history
shopt -s histappend # append history to ~\.bash_history when exiting shell
# Lazy aliases
alias l='ls -l'
alias la='ls -Al'
alias ..='cd ..'
alias tree='tree -C'
alias trls='tree -C | less -R' # -C outputs colour, -R makes less understand color
alias mode='(set -o | grep emacs.*on >/dev/null 2>&1 && echo "emacs mode" || echo "vi mode")'
# Rails aliases
alias sc='./script/console'
alias sg='./script/generate'
alias ss='./script/server'
alias sp='./script/server -e production'
alias t='rake spec'
alias ta='autotest -rails'
alias m='rake db:migrate'
# node
alias nombom="rm -rf node_modules && npm cache clean && npm i && rm -rf bower_components && bower cache clean && bower i && rm -rf tmp"
# SVN aliases
alias svnadd="svn st | grep '^\?' | awk '{print $2}' | xargs svn add"
alias svnrmd="svn st | grep '^\!' | awk '{print $2}' | xargs svn rm"
# git aliases
alias g='git'
# http://stackoverflow.com/a/15009611/128850
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
__git_complete g __git_main
# Vim aliases
alias rvim='mvim --remote-silent '
# Set terminal colors when launching screen
alias tmux="TERM=screen-256color-bce tmux"
# Functions
# Fuzzy cd
# Usage:
# cdf public
# Changes to repos-public directory.
# http://dpaste.org/P59h/
function cdf() {
cd *$1*/
}
# Reload .bashrc
alias refresh='. ~/.bashrc'
export PATH=/Applications/Postgres.app/Contents/MacOS/bin:$PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
function ps1_branch {
b=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
if [ -n "$b" ]; then echo " $b"; fi
}
black="\[\e[30m\]"
red="\[\e[31m\]"
green="\[\e[32m\]"
yellow="\[\e[33m\]"
blue="\[\e[34m\]"
magenta="\[\e[35m\]"
cyan="\[\e[36m\]"
white="\[\e[37m\]"
reset="\[\e[0m\]"
export PS1="${yellow}» $blue\W$magenta\$(ps1_branch)\n$yellow\$$reset "
# Add the following to your ~/.bashrc or ~/.zshrc
#
# Alternatively, copy/symlink this file and source in your shell. See `hitch --setup-path`.
hitch() {
command hitch "$@"
if [[ -s "$HOME/.hitch_export_authors" ]] ; then source "$HOME/.hitch_export_authors" ; fi
}
alias unhitch='hitch -u'
# Uncomment to persist pair info between terminal instances
# hitch
# Set up https://hub.github.com/:
eval "$(hub alias -s)"
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
if [ -n "$NVIM_LISTEN_ADDRESS" ]; then
export VISUAL="nvr -cc split --remote-wait +'set bufhidden=wipe'"
else
export VISUAL="nvim"
fi