-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc
159 lines (130 loc) · 4.32 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
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
export DOTFILES="$HOME/.dotfiles"
# ----------------------- PROMPT ----------------------
# Regular colors
txtblk="$(tput setaf 0 2>/dev/null || echo '\e[0;30m')" # Black
txtred="$(tput setaf 1 2>/dev/null || echo '\e[0;31m')" # Red
txtgrn="$(tput setaf 2 2>/dev/null || echo '\e[0;32m')" # Green
txtylw="$(tput setaf 3 2>/dev/null || echo '\e[0;33m')" # Yellow
txtblu="$(tput setaf 4 2>/dev/null || echo '\e[0;34m')" # Blue
txtpur="$(tput setaf 5 2>/dev/null || echo '\e[0;35m')" # Purple
txtcyn="$(tput setaf 6 2>/dev/null || echo '\e[0;36m')" # Cyan
txtwht="$(tput setaf 7 2>/dev/null || echo '\e[0;37m')" # White
# Reset color
txtrst="$(tput sgr 0 2>/dev/null || echo '\e[0m')" # Text Reset
# Load Git functions
find_git_branch() {
# Based on: http://stackoverflow.com/a/13003854/170413
local branch
if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then
if [[ "$branch" == "HEAD" ]]; then
branch='detached*'
fi
if [[ "$branch" != "detached*" ]]; then
hasbranch=$(git branch -a | egrep remotes/origin/$branch)
if [[ "$hasbranch" != "" ]]; then
commits=$(git rev-list --count origin/$branch..HEAD)
if [[ "$branchexists" != "0" && "$commits" != "0" ]]; then
commits=" >$commits"
else
commits=""
fi
else
commits=""
fi
git_branch="($branch$commits) "
else
git_branch="($branch)"
fi
else
git_branch=""
fi
}
find_git_dirty() {
local status=$(git status --porcelain --untracked-files=no 2> /dev/null)
if [[ "$status" != "" ]]; then
gitcolor="$txtylw"
else
gitcolor="$txtgrn"
fi
}
PROMPT_COMMAND="find_git_branch; find_git_dirty; $PROMPT_COMMAND"
PS1="\[\033[38;5;11m\]\u@\h\[$(tput sgr0)\]\[\033[38;5;10m\]::\[$(tput sgr0)\]\[\033[38;5;6m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\] \[\$gitcolor\]\$git_branch\[$txtrst\]\\$ \[$(tput sgr0)\]"
# ----------------------- END PROMPT ----------------------
export TERM="xterm-256color"
export PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
if [ -d $HOME/.rvm ]; then
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
source $HOME/.rvm/scripts/rvm
fi
if [ -d $HOME/.composer ]; then
export PATH="$PATH:$HOME/.composer/vendor/bin"
fi
if [ -d $HOME/dasht ]; then
export PATH="$PATH:$HOME/dasht/bin"
fi
alias tmux="tmux -2"
alias mux="tmuxinator"
alias t="tmuxinator start"
if type vim > /dev/null; then
export EDITOR=vim
else
export EDITOR=vi
fi
PATH=/opt/local/bin:$PATH
# ----------------------- ALIASES ----------------------
# Git aliases
alias ga='git add'
alias gb='git branch'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gcam='git commit -a -m'
alias gcm='git checkout master'
alias gcd='git checkout develop'
alias gco='git checkout'
alias gcount='git shortlog -sn'
alias gd='git diff'
alias gl='git pull'
alias glg='git log --stat'
alias glgp='git log --stat -p'
alias gm='git merge'
alias gp='git push'
alias gst='git status'
alias grb='git rebase'
alias grbc='git rebase --continue'
alias gt='git tag'
# Rails aliases
alias rc='rails console'
alias rd='rails destroy'
alias rg='rails generate'
alias rgm='rails generate migration'
alias rs='rails server'
alias rdm='rake db:migrate'
alias rdr='rake db:rollback'
alias rr='rake routes'
# Laravel aliases
alias la4='php artisan'
alias la5='php artisan'
alias la4m='php artisan migrate:make'
alias la5m='php artisan make:migration'
# Yarn aliases
alias ya='yarn'
alias yaa='yarn add'
alias yau='yarn upgrade'
# ----------------------- END ALIASES ----------------------
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
if [ ! -d ~/.bashrc.local ]; then
source ~/.bashrc.local
fi
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
[ -f $HOME/.cargo/env ] && . "$HOME/.cargo/env"
# bun
export BUN_INSTALL="$HOME/.bun"
export PATH=$BUN_INSTALL/bin:$PATH
# Generated for envman. Do not edit.
[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"
eval "$(zoxide init bash)"