dotfiles/bashrc

52 lines
1.1 KiB
Bash
Raw Normal View History

2017-11-03 08:46:24 +00:00
# Change prompt if root
2017-11-03 07:49:05 +00:00
if [ $UID -eq 0 ] ; then
PROMPT_SUFFIX='\[\033[1;31m\] # \[\033[0m\]'
else
PROMPT_SUFFIX='\[\033[0;32m\] $ \[\033[0m\]'
fi
2017-11-03 08:46:24 +00:00
# Shorten long usernames
if [ $(whoami | wc -c) -gt 10 ] ; then
USER="me"
else
USER=$(whoami)
fi
PS1='\[\033[0;32m\]${USER}@\h\[\033[0m\] [\[\033[0;33m\]\w\[\]\[\033[0;32m\]]'$PROMPT_SUFFIX
2017-11-03 07:09:33 +00:00
export PATH=$PATH:~/bin:~/local/bin
function tmux_title {
printf '\033]2;%s\033\\' $@
}
tmux_title $(hostname -s)
# Git prompt
GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_FETCH_REMOTE_STATUS=0
GIT_PROMPT_IGNORE_STASH=1
GIT_PROMPT_THEME=Noldorized
source ~/.bash-git-prompt/gitprompt.sh
function prompt_callback {
2017-11-05 08:07:38 +00:00
REPO=$(git remote -v | sed -r 's/^origin.*\/(.*)\ .*/\1/' | head -1)
2017-11-03 07:09:33 +00:00
gp_set_window_title "$REPO($GIT_BRANCH)"
}
# LS_COLORS
eval $(dircolors -b $HOME/.dircolors)
# Global Options
export LS_OPTIONS=""
export LESS='-R'
2017-11-03 07:45:03 +00:00
export TERM=xterm-256color
2017-11-03 07:09:33 +00:00
# Aliases
alias ls="ls --color=always --time-style=long-iso -F"
alias gs="git status"
alias gc="git commit -m"
alias gco="git checkout"
alias gl="git l"
alias ga="git add"
alias gpush="git push"
alias gpull="git pull"