-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bash_profile
92 lines (71 loc) · 2.6 KB
/
.bash_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
export PATH=/usr/local/bin:$PATH
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export EDITOR=vim
# Variables
CUR_PATH=$(readlink ~/.bash_profile)
CUR_DIR=$(dirname "${CUR_PATH}")
# Shortcuts
alias ll='ls -lah'
# Taken from http://stackoverflow.com/questions/6127328/how-can-i-delete-all-git-branches-which-have-been-merged
alias gitcl='git branch --merged | grep -v "\*" | grep -v master | xargs -n 1 git branch -d'
# Based off this: https://coderwall.com/p/up1qma/git-remove-local-branches-not-on-remote
alias gitcls="git remote prune origin && git branch -vv | grep ' gone]' | cut -c3- | awk '{print \$1}' | xargs git branch -D"
# Runs a command in a screen.
alias screencmd='screen -L -dm time'
# Starts a simple HTTP server.
alias serve='python -m SimpleHTTPServer'
alias dc='docker-compose'
if [[ $- == *i* ]]; then
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
export PS1="\[$(tput setaf 4)\]\u\[$(tput setaf 5)\]@\h \[$(tput setaf 6)\]\W\\$\[$(tput sgr0)\] "
else
export PS1="\[$(tput setaf 4)\]\u \[$(tput setaf 6)\]\W\\$\[$(tput sgr0)\] "
fi
fi
# macOS is a jerk and doesn't load .bashrc automatically.
if [ -f "$HOME/.bashrc" ]; then
source "$HOME/.bashrc"
fi
# Loads custom bash files, if the file exists.
if [ -f "$HOME/.bash_custom" ]; then
source "$HOME/.bash_custom"
fi
# Autocompletion
. "${HOME}/${CUR_DIR}/git-completion.bash"
. "${HOME}/${CUR_DIR}/wp-completion.bash"
# Taken from: https://medium.com/@jamischarles/adding-autocomplete-to-npm-install-5efd3c424067
# BASH standalone npm install autocomplete. Add this to ~/.bashrc file.
_npm_install_completion () {
local words cword
if type _get_comp_words_by_ref &>/dev/null; then
_get_comp_words_by_ref -n = -n @ -w words -i cword
else
cword="$COMP_CWORD"
words=("${COMP_WORDS[@]}")
fi
local si="$IFS"
# if your npm command includes `install` or `i `
if [[ ${words[@]} =~ 'install' ]] || [[ ${words[@]} =~ 'i ' ]]; then
local cur=${COMP_WORDS[COMP_CWORD]}
# supply autocomplete words from `~/.npm`, with $cur being value of current expansion like 'expre'
COMPREPLY=( $( compgen -W "$(ls ~/.npm )" -- $cur ) )
fi
IFS="$si"
}
# bind the above function to `npm` autocompletion
complete -o default -F _npm_install_completion npm
## END BASH npm install autocomplete
# Adds Grunt autocompletion.
# See: https://github.com/gruntjs/grunt-cli#shell-tab-auto-completion
if hash grunt 2>/dev/null; then
eval "$(grunt --completion=bash)"
fi
# Adds Hub alias.
# See: https://github.com/github/hub#aliasing
if hash hub 2>/dev/null; then
eval "$(hub alias -s)"
fi
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# For grunt watch.
ulimit -n 1024