Skip to content

Instantly share code, notes, and snippets.

@jancimajek
Last active October 12, 2015 01:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jancimajek/3952707 to your computer and use it in GitHub Desktop.
Save jancimajek/3952707 to your computer and use it in GitHub Desktop.
My bashrc file
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
# Support for GIT branch and status info
# @see http://www.bramschoenmakers.nl/en/node/624
# @see http://denis.tumblr.com/post/71390665/adding-bash-completion-for-git-on-mac-os-x-snow-leopard
if [ -f /etc/git-completion.bash ]; then
. /etc/git-completion.bash
fi
# Enable git status info
export GIT_PS1_SHOWDIRTYSTATE=1
# If id command returns zero, you’ve root access.
if [ $(id -u) -eq 0 ];
then # you are root, set red colour prompt
export PS1='\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\[\033[01;33m\]$(__git_ps1)\[\033[00m\]# '
else # normal
export PS1='\[\033[00;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\[\033[01;33m\]$(__git_ps1)\[\033[00m\]\$ '
fi
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL,
# including the host name to disambiguate local vs.
# remote connections. Percent-escape spaces.
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
alias ls="ls -G"
alias ll="ls -laht"
export EDITOR=vi
export PATH=$PATH:/usr/local/mysql/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment