~ caio
/.bashrc
Fully working .bashrc without my personal configurations based on my work environment.
# plain .bashrc - should work on any Linux environment
# assembled by: Caio Romão
# setting up custom bin-dir
if [ -d ${HOME}/bin ]
then
export PATH=${HOME}/bin:$PATH
fi
# Bash completion
# The username restriction is due to network weirdness
if [ -e /etc/bash*completion ] && [ "`whoami`" != "ra059467" ]
then
. /etc/bash*completion
fi
# EXPORTS
export GWT_EXTERNAL_BROWSER="firefox"
# PROMPT
function proml
{
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local WHITE="\[\033[0;37m\]"
local NO_COLOUR="\[\033[0m\]"
case $TERM in
xterm*|rxvt*)
if [ -n "$CLEARCASE_ROOT" ]
then
TITLEBAR='\[\033]0;'
TITLEBAR="$TITLEBAR$(basename $CLEARCASE_ROOT)"
TITLEBAR="$TITLEBAR@\h:\w\007\]"
else
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
fi
;;
*)
TITLEBAR=""
;;
esac
if [ -n "$CLEARCASE_ROOT" ]
then
PS1="${TITLEBAR}$BLUE[$RED$(basename $CLEARCASE_ROOT)$BLUE:$WHITE\w$BLUE]"
else
PS1="${TITLEBAR}$BLUE[$WHITE\h:\w$BLUE]"
fi
if [[ "$(whoami)" = "root" ]]
then
PS1="$PS1$WHITE#$NO_COLOUR "
else
PS1="$PS1$WHITE\$$NO_COLOUR "
fi
PS2='> '
PS4='+ '
}
proml
###########
# Aliases #
###########
alias c='clear'
alias mv='mv -i'
alias cp=' cp -i'
alias rm='rm -i'
alias j='jobs'
alias h='history'
alias grep='egrep'
alias ls='ls --color=always --time-style=iso -h -F --quoting-style=escape'
alias l='ls -lhG'
alias la='ls -lhA'
alias ad='ls -A -d */'
alias a='ls -d .*'
alias dc=popd
alias d='dirs -v'
# This makes pushd behave like cd when no argument is passed
function cdpushd()
{
if [ -n "$1" ]
then
pushd "$*"
else
if [ "$(pwd)" != "$HOME" ]
then
pushd ~
fi
fi
}
alias cd=cdpushd
alias ctags='ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .'
###########
# History #
###########
export HISTSIZE=1000
export HISTFILESIZE=1000
export HISTIGNORE="ls:l:c:clear:d:cd:dc:bg:fg"
export HISTCONTROL=ignoredups
#############
# Mercurial #
#############
# Opens vim in diff mode comparing the current version with
# the one versioned
function hgdiff()
{
hg cat $1 | gvim - -c ":vert diffsplit $1" -c "map q :qa!";
}
##########################################################################
# Add sources bellow this comment to avoid replacing of the new commands #
##########################################################################
# load Motorola config file
if [[ "$(whoami)" = "wxmp34" ]] && [[ -f ~/.source/motorolarc ]]
then
source ~/.source/motorolarc
fi
# load Unicamp config file
if [[ "$(whoami)" = "ra059467" ]] && [[ -f ~/.source/unicamprc ]]
then
source ~/.source/unicamprc
fi