-
Notifications
You must be signed in to change notification settings - Fork 2
/
.functions
83 lines (71 loc) · 1.63 KB
/
.functions
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
# Goes up a certain amount of directories
# Usage: up 2
function up() {
local d=""
limit=$1
for ((i=1 ; i <= limit ; i++))
do
d=$d/..
done
d=$(echo $d | sed 's/^\///')
if [ -z "$d" ]; then
d=..
fi
cd $d
}
# Start Pow.cx
function powup() {
launchctl load ~/Library/LaunchAgents/cx.pow.powd.plist
sudo launchctl load /Library/LaunchDaemons/cx.pow.firewall.plist
}
# Stop Pow.cx
function powdown() {
launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist
sudo launchctl unload /Library/LaunchDaemons/cx.pow.firewall.plist
}
# Branch diffs in Kaleidoscope
# Provide two branches e.g: gd master develop
# Or leave empty to diff current branch
function gd() {
git difftool $1 $2 -y -t Kaleidoscope
}
# Git all in one
branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/')
function ga() {
git add --all
git commit -m "$1"
git push origin $branch
}
# Delete local branch
function gdb() {
git branch -D $1
}
# Delete remote branch
function gdrb() {
git push origin --delete $1
}
# Change git origin to ssh
function git-ssh() {
REPO=$(basename `git rev-parse --show-toplevel`)
git remote set-url origin git@github.com:lukakerr/$REPO.git
}
# Edit given folder in sublime
function e() {
subl `find ~ -type d -iname $1 -maxdepth 3 -not -path '*/\.*' -print -quit`
}
# cd into found directory
function c() {
cd `find ~ -type d -iname \*$1\* -maxdepth 5 -not -path '*/\.*' -print -quit`
}
# diff-so-fancy
function dif() {
git diff --no-index --color "$@" | diff-so-fancy
}
# tmux
function tmk() {
tmux kill-session -t "$1"
}
# source RVM
function srvm() {
source ~/.rvm/scripts/rvm
}