dotfiles/.bashrc

66 lines
2 KiB
Bash
Raw Normal View History

# [----------------------------------------------------------------------------]
# [----------------------------- PROMPT ---------------------------------------]
# [----------------------------------------------------------------------------]
hostn=$(hostname -s)
usern=$(whoami)
function prompt {
ctime=$(date +%T)
prmpt="[${PWD}][${ctime}]"
2013-02-24 16:20:59 -05:00
let FILLS=${COLUMNS}-${#prmpt}
LINE=""
if [[ "$PWD" =~ "/home/$usern" ]]; then
let FILLS=$FILLS+5+${#usern}
fi
for (( f=0; f<$FILLS; f++ ))
do
2013-02-23 14:16:31 -05:00
LINE=$LINE"\e[0;34;44m-"
done
2013-02-23 14:16:31 -05:00
PS1="\e[44;1;37m[\t] \w ${LINE}\e[0m\n"
if [ "$SSH_CONNECTION" == "" ]; then
2013-02-23 14:16:31 -05:00
PS1="$PS1\[\e[1;32;40m\][\u@\h]"
else
2013-02-25 14:53:12 -05:00
PS1="$PS1\[\e[1;33;40m\][\u@\h]"
fi
2013-02-23 14:16:31 -05:00
PS1="$PS1\$(if [ \$? = 0 ]; then echo -e \"\$\"; else echo -e \"\[\e[0;31m\]\$\"; fi)\[\e[0m\] "
}
PROMPT_COMMAND=prompt
# [----------------------------------------------------------------------------]
# [----------------------------- ALIAS ---------------------------------------]
# [----------------------------------------------------------------------------]
2013-02-24 16:20:59 -05:00
2012-04-05 05:39:31 -04:00
# Common parameters
2013-02-24 16:20:59 -05:00
alias ls='ls -v --color=auto'
alias ll='ls -lavh'
alias grep='grep --color'
2012-04-05 05:39:31 -04:00
2013-02-22 05:04:26 -05:00
alias sudo='sudo env PATH=$PATH'
2012-08-14 14:26:28 -04:00
2013-02-24 16:20:59 -05:00
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
# for git
alias get='git'
alias ga='git add'
alias gaa='git add .'
alias gs='git status'
alias gl='git log'
alias gcm='git commit -m'
alias gcf='git commit -F'
# [----------------------------------------------------------------------------]
# [------------------------------ OTHER ---------------------------------------]
# [----------------------------------------------------------------------------]
2012-04-05 05:39:31 -04:00
# Case insensitive matching
2012-05-15 14:50:49 -04:00
shopt -s nocaseglob
2012-07-19 15:39:23 -04:00
# [----------------------------------------------------------------------------]
# [------------------------------ PATH ----------------------------------------]
# [----------------------------------------------------------------------------]
2012-11-30 13:36:26 -05:00
PATH=$PATH:$HOME/bin