Created
May 29, 2025 19:17
-
-
Save SeanChDavis/23d98922af40462665b06525e9a2d7f2 to your computer and use it in GitHub Desktop.
bashrc example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### COLORS {{{ | |
NONE="\[\033[0m\]" | |
BK="\[\033[0;30m\]" #Black | |
EBK="\[\033[1;30m\]" | |
RD="\[\033[0;31m\]" #Red | |
ERD="\[\033[1;31m\]" | |
GR="\[\033[0;32m\]" #Green | |
EGR="\[\033[1;32m\]" | |
YW="\[\033[0;33m\]" #Yellow | |
EYW="\[\033[1;33m\]" | |
BL="\[\033[0;34m\]" #Blue | |
EBL="\[\033[1;34m\]" | |
MG="\[\033[0;35m\]" #Magenta | |
EMG="\[\033[1;35m\]" | |
CY="\[\033[0;36m\]" #Cyan | |
ECY="\[\033[1;36m\]" | |
WH="\[\033[0;37m\]" #White | |
EWH="\[\033[1;37m\]" | |
### COLORS }}} | |
### ENVIRONMENT VARIABLES {{{ | |
# MISC OPTIONS | |
export EDITOR=vim | |
export HISTCONTROL=ignoredups | |
export HISTSIZE=5000 | |
export HISTFILESIZE=1000 | |
export HISTIGNORE='ls:pwd:exit:clear' | |
shopt -s cdable_vars | |
shopt -s cdspell | |
shopt -s checkwinsize | |
shopt -s cmdhist | |
shopt -s extglob | |
set +o noclobber | |
# PROMPT | |
if [[ `id -un` != root ]]; then | |
PS1="[${MG}\u@\h${CY} \W${YW}\$(parse_git_branch)\$(git_dirty_flag)${NONE}]$ " | |
else | |
PS1="[${RD}\u@\h${CY} \W${GR}\$(parse_git_branch)\$(git_dirty_flag)${NONE}]# " | |
fi | |
### ENVIRONMENT VARIABLES }}} | |
### ALIASES {{{ | |
alias back='cd $OLDPWD' | |
alias grep='grep -n --color=auto' | |
alias reload='source ~/.bashrc' | |
alias vi='vim' | |
alias sudo='sudo ' | |
alias ssh='ssh -A' | |
### SEAN'S SHORTCUTS | |
alias c='clear' | |
alias gs='git status' | |
alias ga='git add .' | |
alias gap='git add -p' | |
alias gcm='git checkout master' | |
alias gcl='git checkout -' | |
alias gpush='git push origin' | |
alias gpull='git pull origin' | |
alias mpush='git push origin master' | |
alias mpull='git pull origin master' | |
alias gw='grunt watch' | |
alias ..='cd ../' | |
alias ...='cd ../../' | |
alias ....='cd ../../../' | |
alias .....='cd ../../../../' | |
alias local="cd 'C:\Users\sean\Sites\'" | |
### ALIASES }}} | |
### FUNCTIONS {{{ | |
git_dirty_flag() { | |
git status 2> /dev/null | grep -c : | awk '{if ($1 > 0) print "*"}' | |
} | |
parse_git_branch() { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
webroot() { | |
if [[ -z ${1} ]]; then | |
echo "webroot <root> <dir>" | |
return | |
fi | |
BASEPATH=' C:\Users\sean\Sites\' | |
if [[ ! -d ${BASEPATH}${1} ]]; then | |
echo "webroot '${1}' not found!" | |
return | |
fi | |
if [[ -z ${2} ]]; then | |
cd ${BASEPATH}${1} | |
return | |
fi | |
case ${2} in | |
'plugins') | |
cd ${BASEPATH}${1}\app\public\wp-content\plugins ;; | |
'themes') | |
cd ${BASEPATH}${1}\app\public\wp-content\themes ;; | |
*) | |
if [[ ! -d ${BASEPATH}${1}\${2} ]]; then | |
echo "directory '${2}' does not exist in '${1}'" | |
return | |
else | |
cd ${BASEPATH}${1}\${2} | |
fi | |
;; | |
esac | |
} | |
### FUNCTIONS }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment