-
Notifications
You must be signed in to change notification settings - Fork 0
/
.matt_profile
138 lines (120 loc) · 3.83 KB
/
.matt_profile
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
# for homebrew, make sure homebrew stuff is last in path
export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH
function mi() { mvim "$@" ;}
alias listjvms='/usr/libexec/java_home -V' #alias workspaces='cd ~/workspaces'
# if pyenv is installed, initialize it
if hash pyenv 2>/dev/null; then
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"
fi
# send notifications on MacOS Mavericks and greater
# Ex: npm install && sys-notify Hey! "your install is done!"
# From https://apple.stackexchange.com/a/303290
function _sys_notify() {
local notification_command="display notification \"$2\" with title \"$1\""
osascript -e "$notification_command"
}
alias sys-notify="_sys_notify $1 $2"
# for nvm
export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"
# git
alias gs='clear; git status'
alias sstatus='clear; svn status'
function gadd() { git add "$@" ;}
# show recently updated branches http://stackoverflow.com/a/5972362
function gbranches() { git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)' ;}
# java
export MAVEN_OPTS='-Xmx2048m '
if [[ "$(uname)" == "Darwin" ]]; then
## This is OS X specific stuff
## list out all the jvm's you have
alias javaversions='/usr/libexec/java_home -V'
fi
if [ -n "$ZSH_VERSION" ]; then
# assume Zsh
# use whatever's in .zshrc
echo "Using ZSH!"
elif [ -n "$BASH_VERSION" ]; then
# assume Bash
shopt -s histappend
# history stuff, erase dups, save on session close
export HISTCONTROL=erasedups
export HISTSIZE=10000
# from a coworkers helpful dotfiles
alias p=pwd
alias v=vim
alias c=clear
alias g=git
alias l='ls -al'
alias lr='ls -ltr| more'
alias m=more
alias lt='ls -lrt | more'
alias ll='ls -al | more'
alias la='ls -lart | more'
alias lsd='ls -lt | grep "^d"'
#alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
alias lo=logout
alias cls=clear
alias h=history
alias tf='tail -f $1'
alias myps='ps -aef | grep -i $1'
alias mt='ps -aef | grep -i tomcat'
alias sb='echo Sourcing bash;source ~/.bash_profile'
fi
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
#export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
set -o vi
# command to set title bar of command window/tab to whatever you want
function title {
echo -ne "\033]0;"$*"\007"
}
alias cd=cd_func
# little funtction from
# http://www.oliverelliott.org/article/computing/ref_unix/75/
# to make cd history easier
cd_func ()
{
local x2 the_new_dir adir index;
local -i cnt;
if [[ $1 == "--" ]]; then
dirs -v;
return 0;
fi;
the_new_dir=$1;
[[ -z $1 ]] && the_new_dir=$HOME;
if [[ ${the_new_dir:0:1} == '-' ]]; then
index=${the_new_dir:1};
[[ -z $index ]] && index=1;
adir=$(dirs +$index);
[[ -z $adir ]] && return 1;
the_new_dir=$adir;
fi;
[[ ${the_new_dir:0:1} == '~' ]] && the_new_dir="${HOME}${the_new_dir:1}";
pushd "${the_new_dir}" > /dev/null;
[[ $? -ne 0 ]] && return 1;
the_new_dir=$(pwd);
popd -n +11 2> /dev/null > /dev/null;
for ((cnt=1; cnt <= 10; cnt++))
do
x2=$(dirs +${cnt} 2>/dev/null);
[[ $? -ne 0 ]] && return 0;
[[ ${x2:0:1} == '~' ]] && x2="${HOME}${x2:1}";
if [[ "${x2}" == "${the_new_dir}" ]]; then
popd -n +$cnt 2> /dev/null > /dev/null;
cnt=cnt-1;
fi;
done;
return 0
}
# https://dev.to/rmpato/git-pull-multiple-repositories-at-once-4l68
alias multipull="find . -mindepth 1 -maxdepth 1 -type d -print -exec git -C {} pull \;"
function multicheckout() {
find . -mindepth 1 -maxdepth 1 -type d -print -exec git -C {} checkout $1 \;
}