Created
March 26, 2014 12:41
-
-
Save digitalkaoz/9782235 to your computer and use it in GitHub Desktop.
bashrc foo
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
#fetches a git branch from a repository | |
ps1_git_extra() { | |
branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | |
if [ -z "$branch" ] ; then return ; fi | |
local timeout=1 | |
echo "[$branch$statmark]" | |
} | |
git_dirty() { | |
# check if we're in a git repo | |
command git rev-parse --is-inside-work-tree &>/dev/null || return | |
# check if it's dirty | |
command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo '*' | |
} | |
#fetches a svn branch from a repository | |
ps1_svn_extra() { | |
issvn=`pwd`/.svn | |
if [ ! -e $issvn ] ; then return ; fi | |
branch=$(svn info | grep '^URL:' | egrep -o '(tags|branches)/[^/]+|trunk' | egrep -o '[^/]+$') | |
if [ -z "$branch" ] ; then return ; fi | |
local timeout=1 | |
echo "[$branch$statmark]" | |
} | |
#aliases | |
alias grep='GREP_COLOR="1;33;40" LANG=C grep --color=auto' | |
alias la='ls -la' | |
alias ls='ls --color' | |
#var exports | |
export CLICOLOR=1 | |
export EDITOR=vim | |
export LSCOLORS=ExFxCxDxBxegedabagacad | |
#include bash completions | |
if [ -f /usr/etc/bash_completion ]; then | |
. /usr/etc/bash_completion | |
fi | |
# If this is an xterm set the title to user@host:dir | |
case "$TERM" in | |
xterm*|rxvt*) | |
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME} \007"' | |
;; | |
*) | |
;; | |
esac | |
#set fancy prompt | |
PS1="\n<\[\033[0;32m\]\h\[\033[0m\]:\[\033[0;37m\]\u\[\033[0m\]> [\$(date +%m-%d\" \"%H:%M)] \[\033[33m\]\$(ps1_svn_extra)\$(ps1_git_extra) \$(git_dirty)\[\033[00m\] \w: " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment