Created
March 24, 2009 16:34
-
-
Save umuro/84197 to your computer and use it in GitHub Desktop.
My .bashrc; color prompt with current GIT and RVM info... And other improvements...
This file contains 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
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
#[ -z "$PS1" ] && return | |
if [[ -n "$PS1" ]] ; then | |
# don't put duplicate lines in the history. See bash(1) for more options | |
export HISTCONTROL=ignoreboth | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# make less more friendly for non-text input files, see lesspipe(1) | |
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" | |
# set variable identifying the chroot you work in (used in the prompt below) | |
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then | |
debian_chroot=$(cat /etc/debian_chroot) | |
fi | |
# set a fancy prompt (non-color, unless we know we "want" color) | |
case "$TERM" in | |
xterm-color) | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
;; | |
*) | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
;; | |
esac | |
# Comment in the above and uncomment this below for a color prompt | |
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
# 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}: ${PWD/$HOME/~}\007"' | |
;; | |
*) | |
;; | |
esac | |
# Alias definitions. | |
# You may want to put all your additions into a separate file like | |
# ~/.bash_aliases, instead of adding them here directly. | |
# See /usr/share/doc/bash-doc/examples in the bash-doc package. | |
#if [ -f ~/.bash_aliases ]; then | |
# . ~/.bash_aliases | |
#fi | |
# enable color support of ls and also add handy aliases | |
if [ "$TERM" != "dumb" ]; then | |
eval "`dircolors -b`" | |
alias ls='ls --color=auto' | |
#alias dir='ls --color=auto --format=vertical' | |
#alias vdir='ls --color=auto --format=long' | |
fi | |
# some more ls aliases | |
#alias ll='ls -l' | |
#alias la='ls -A' | |
#alias l='ls -CF' | |
# enable programmable completion features (you don't need to enable | |
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |
# sources /etc/bash.bashrc). | |
if [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
# Umur's Custom | |
# Define a few Colours for PS1 | |
BLACK='\[\e[0;30m\]' | |
BLUE='\[\e[0;34m\]' | |
GREEN='\[\e[0;32m\]' | |
CYAN='\[\e[0;36m\]' | |
RED='\[\e[0;31m\]' | |
PURPLE='\[\e[0;35m\]' | |
BROWN='\[\e[0;33m\]' | |
LIGHTGRAY='\[\e[0;37m\]' | |
DARKGRAY='\[\e[1;30m\]' | |
LIGHTBLUE='\[\e[1;34m\]' | |
LIGHTGREEN='\[\e[1;32m\]' | |
LIGHTCYAN='\[\e[1;36m\]' | |
LIGHTRED='\[\e[1;31m\]' | |
LIGHTPURPLE='\[\e[1;35m\]' | |
YELLOW='\[\e[1;33m\]' | |
WHITE='\[\e[1;37m\]' | |
NC='\[\e[0m\]' # No Color | |
# Define a few Colours for echo | |
_BLACK='\e[0;30m' | |
_BLUE='\e[0;34m' | |
_GREEN='\e[0;32m' | |
_CYAN='\e[0;36m' | |
_RED='\e[0;31m' | |
_PURPLE='\e[0;35m' | |
_BROWN='\e[0;33m' | |
_LIGHTGRAY='\e[0;37m' | |
_DARKGRAY='\e[1;30m' | |
_LIGHTBLUE='\e[1;34m' | |
_LIGHTGREEN='\e[1;32m' | |
_LIGHTCYAN='\e[1;36m' | |
_LIGHTRED='\e[1;31m' | |
_LIGHTPURPLE='\e[1;35m' | |
_YELLOW='\e[1;33m' | |
_WHITE='\e[1;37m' | |
_NC='\e[0m' # No Color | |
# enable color support of ls and also add handy aliases | |
if [ "$TERM" != "dumb" ]; then | |
[ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors" | |
[ -e "$DIR_COLORS" ] || DIR_COLORS="" | |
eval "`dircolors -b $DIR_COLORS`" | |
alias ls='ls --color=auto' | |
#alias dir='ls --color=auto --format=vertical' | |
#alias vdir='ls --color=auto --format=long' | |
fi | |
case "$TERM" in | |
xterm*|rxvt*) | |
export PS1="${DARKGRAY}(\!)\u@\h, ${BLUE}\W${RED}(parse_git_branch)$ ${NC} " | |
;; | |
*) | |
;; | |
esac | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function rvm_gem_set { | |
rvm gemset name | grep -v \/ | |
} | |
function proml { | |
case $TERM in | |
xterm*) | |
TITLEBAR="${DARKGRAY}(\!)\u@\h, ${BLUE}\W$ ${NC} " | |
TITLEBAR='\[\033]0;\u@\h:\w\007\]' | |
;; | |
*) | |
TITLEBAR="" | |
;; | |
esac | |
PROMPT_COMMAND='PS1="${TITLEBAR}\ | |
$BLUE[$BLUE\$(date +%H:%M)${NC}]\ | |
$BLUE[$BLUE\u@\h: **/\W]$RED$(rvm_gem_set)$RED$(parse_git_branch)$NC\ | |
$NC\$ "' | |
PS2='> ' | |
PS4='+ ' | |
} | |
proml | |
shopt -s cmdhist | |
export HISTFILESIZE=4000000000 | |
export HISTSIZE=40000 | |
alias hisg="history | grep " | |
alias rakg="rake -T " | |
alias ll='ls -l' | |
alias skate="kate >&/dev/null " | |
alias skomp="kompare >&/dev/null " | |
alias rmbackups="find -name '*~' -exec rm '{}' \;" #delete backup files | |
alias sshc='ssh -c arcfour,blowfish-cbc -C ' | |
alias search="grep -R " | |
alias g="grep" | |
alias and="grep" | |
alias not="grep -v" | |
alias o='xdg-open ' | |
alias upgrade="sudo apt-get update && sudo apt-get upgrade -y --force-yes && sudo apt-get dist-upgrade -y --force-yes" | |
alias gco="git checkout " | |
alias gba="git branch -a" | |
alias gbr="git branch " | |
alias testall="rake test" | |
alias testpush="testall && git push" | |
#export VP=vendor/plugins | |
#export GEMLIB=/usr/lib/ruby/gems/1.8/ | |
#export HOBO=/usr/lib/ruby/gems/1.8/gems/hobo-1.0.2/ | |
#export ACTIVE_RECORD=/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8 | |
export MOZ_DISABLE_PANGO=1 | |
# WELCOME SCREEN | |
################################################## ##### | |
clear | |
echo -ne "${_LIGHTBLUE}" "Hello, $USER. Today is, "; date | |
echo -e "${_GREEN}"; cal -3; | |
echo -ne "${_CYAN}"; | |
# UMUR PERSONAL | |
############### | |
export W=~/nondoc/workspaces | |
export A=~/nondoc/workspaces/active | |
export CDPATH=.:$W | |
export EDITOR=mousepad | |
#update-alternatives --query gems | |
# This is a good place to source rvm v v v | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment