forked from rmm5t/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbash_aliases
218 lines (181 loc) · 6.18 KB
/
bash_aliases
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# Adds an alias to the current shell and to this file.
# Borrowed from Mislav (http://github.com/mislav/dotfiles/tree/master/bash_aliases)
add-alias ()
{
local name=$1 value=$2
echo "alias $name='$value'" >> ~/.bash_aliases
eval "alias $name='$value'"
alias $name
}
############################################################
## List
############################################################
if [[ `uname` == 'Darwin' ]]; then
alias ls="ls -G"
# good for dark backgrounds
export LSCOLORS=gxfxcxdxbxegedabagacad
else
alias ls="ls --color=auto"
# good for dark backgrounds
export LS_COLORS='no=00:fi=00:di=00;36:ln=00;35:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;31:'
# For LS_COLORS template: $ dircolors /etc/DIR_COLORS
fi
alias l="ls"
alias ll="ls -l"
alias la="ls -a"
alias lal="ls -al"
############################################################
## Git
############################################################
alias git="hub"
alias g="git"
alias gb="git branch"
alias gc="git commit -v"
alias gca="git commit -v -a"
alias gd="git diff --word-diff"
alias gl="git pull"
alias glr="git pull --rebase"
alias glrb="git fetch && git rebase origin/master"
alias gp="git push"
alias gs="git status; echo; echo Skipped:; echo; git skipped"
alias gg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
alias ggs="gg --stat"
alias gsl="git shortlog -sn"
alias gw="git whatchanged"
alias gst="git stash"
alias gstp="git stash pop"
alias gsp="git stash pop"
alias ts="tig status"
alias gsui="git submodule update --init"
alias gsur="git submodule update --remote"
alias grb="git rebase "
alias gri="git rebase -i "
alias gmo="git merge origin/master"
alias gup='gst && glr && gstp'
alias gupb='gst && glrb && gstp'
alias amend="g commit --amend"
alias gcs="gh copilot suggest"
# Useful report of what has been committed locally but not yet pushed to another
# branch. Defaults to the remote origin/master. The u is supposed to stand for
# undone, unpushed, or something.
function gu {
local branch=$1
if [ -z "$1" ]; then
branch=master
fi
if [[ ! "$branch" =~ "/" ]]; then
branch=origin/$branch
fi
local cmd="git cherry -v $branch"
echo $cmd
$cmd
}
function gco {
if [ -z "$1" ]; then
git checkout $(git branch | fzf)
else
git checkout $*
fi
}
function st {
if [ -d ".svn" ]; then
svn status
else
git status
fi
}
############################################################
## Subversion
############################################################
# Remove all .svn folders from directory recursively
alias svn-clean='find . -name .svn -print0 | xargs -0 rm -rf'
############################################################
## OS X
############################################################
# Get rid of those pesky .DS_Store files recursively
alias dstore-clean='find . -type f -name .DS_Store -print0 | xargs -0 rm'
# Track who is listening to your iTunes music
alias whotunes='lsof -r 2 -n -P -F n -c iTunes -a -i TCP@`hostname`:3689'
############################################################
## Bundler
############################################################
alias b="bundle"
alias bu="b update"
alias be="b exec"
alias bi="b install"
alias bil='bi --local'
alias binit="bi && b package && echo 'vendor/ruby' >> .gitignore"
alias bo="EDITOR=nvim b open"
############################################################
## Ruby
############################################################
alias r="rake"
alias s="spring"
alias smp="staticmatic preview ."
alias irb="echo Don\\'t you really want pry? or type irbirb."
alias irbirb="\\irb"
alias bs="browser-sync start --files=\"app/assets/stylesheets/**/*.sass,app/assets/javascripts/**/*.coffee,app/views/**/*.slim,vendor/assets/**/*\" --port=3001 --proxy "
# export GEMS=`gem env gemdir`/gems
# function gemfind {
# echo `ls $GEMS | grep -i $1 | sort | tail -1`
# }
# Use: gemcd <name>, cd's into your gems directory
# that best matches the name provided.
# function gemcd {
# cd $GEMS/`gemfind $1`
# }
# Use: gemdoc <gem name>, opens the rdoc of the gem
# that best matches the name provided.
# function gemdoc {
# open $GEMS/../doc/`gemfind $1`/rdoc/index.html
# }
function rinstall {
ruby-build $1 ~/.rbenv/versions/$1
}
alias rhash="rbenv rehash"
############################################################
## Heroku
############################################################
function hstaging {
be heroku $* --remote staging
}
function hproduction {
be heroku $* --remote production
}
############################################################
## Rails
############################################################
alias ss="script/server"
alias sg="script/generate"
alias sc="script/console"
alias tl='tail -f log/development.log'
alias rtags='ctags -e -R app lib vendor tasks'
alias rdbm='rake db:migrate'
alias test="RAILS_ENV=test"
alias dev="RAILS_ENV=development"
############################################################
## Miscellaneous
############################################################
if [ -f /Applications/Emacs.app/Contents/MacOS/Emacs ]; then
alias emacs='/Applications/Emacs.app/Contents/MacOS/Emacs'
alias emacsclient='/Applications/Emacs.app/Contents/MacOS/bin/emacsclient'
fi
alias serve='python -m SimpleHTTPServer'
alias grep='GREP_COLOR="1;37;41" grep --color=auto'
alias wgeto="wget -q -O -"
alias sha1="openssl dgst -sha1"
alias sha2="openssl dgst -sha256"
alias b64="openssl enc -base64"
alias flushdns='dscacheutil -flushcache'
alias repair-mongo='rm /usr/local/var/mongodb/mongod.lock && mongod --repair'
alias ring='open -a Terminal; growlnotify -m "Terminal process is done."; afplay /System/Library/Sounds/Glass.aiff'
alias top=htop
alias tmux='TERM=screen-256color tmux'
# Sets a particular pane to be the target various tmux-enabled utilities
alias target='echo $TMUX | cut -f1 -d, > .tmux-target; tmux display-message -p "#{window_id}.#{pane_id}" >> .tmux-target'
alias t='target'
alias ws="rbenv shell 2.7.5 && working_set"
############################################################
alias vi=nvim
alias clcl='clear; tmux clear-history'
alias cv="TERM=xterm-256color cdb"