Last active
February 23, 2016 15:47
-
-
Save ruph/3933700 to your computer and use it in GitHub Desktop.
bash settings
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
Set the PS1 prompt (with colors). | |
# Based on http://www-128.ibm.com/developerworks/linux/library/l-tip-prompt/ | |
# And http://networking.ringofsaturn.com/Unix/Bash-prompts.php . | |
# PS1="\h\[\e[32;1m\]:\[\e[32;1m\]\w$ \[\e[0m\]" | |
## GIT / SVN aware prompt | |
BLACK="\[\033[0;38m\]" | |
RED="\[\033[0;31m\]" | |
RED_BOLD="\[\033[01;31m\]" | |
BLUE="\[\033[01;34m\]" | |
GREEN="\[\033[0;32m\]" | |
parse_git_branch () { | |
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# (git::\1)#' | |
} | |
parse_svn_branch() { | |
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | egrep -o '(tags|branches)/[^/]+|trunk' | egrep -o '[^/]+$' | awk '{print " ("$1")" }' | |
} | |
parse_svn_url() { | |
svn info 2>/dev/null | sed -ne 's#^URL: ##p' | |
} | |
parse_svn_repository_root() { | |
svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p' | |
} | |
PS1='\h\[\e[32;1m\]:\[\e[32;1m\]\w\[\033[0;31m\]$(parse_git_branch)$(parse_svn_branch)\[\033[00m\]\$ ' | |
# Set the default editor to vim. | |
export EDITOR=vim | |
# Proper java home | |
export JAVA_HOME=$(/usr/libexec/java_home) | |
# Set bash history | |
HISTFILE="$HOME/.bash_history" | |
HISTFILESIZE=10240 | |
HISTSIZE=10240 | |
# Avoid succesive duplicates in the bash command history. | |
export HISTCONTROL=ignoredups:erasedups:ignorespace | |
# ... and ignore ls and cd (if they are called without arguments), and bg, | |
# fg, exit, and clear, _and_ any command prefaced with a space | |
export HISTIGNORE='&:clear:ls:cd:[bf]g:exit:[ t\]*' | |
# Append commands to the bash command history file (~/.bash_history) | |
# instead of overwriting it. | |
shopt -s histappend | |
# Write out changes in history after every command | |
export PROMPT_COMMAND="history -a" | |
# Make grep more user friendly by highlighting matches | |
# and exclude grepping through .svn folders. | |
alias grep='grep --color=auto --exclude-dir=\.svn' | |
# Sweet colors | |
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxegedabagaced | |
alias svnadd="svn st | grep ^? | awk '{print \$2}' | xargs svn add" | |
alias svndel="svn st | grep ^! | awk '{print \$2}' | xargs svn del" | |
alias svnci="svn st | grep ^[AMD] | awk '{print \$2}' | xargs svn ci" | |
# Quick way to rebuild the Launch Services database and get rid | |
# of duplicates in the Open With submenu. | |
alias fixopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user' | |
# GNU GLOBAL (gtags) | |
export GTAGSCONF="$HOME/.globalrc" | |
export GTAGSLABEL="pygments-parser" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment