dotfiles-server/.bashrc

41 lines
735 B
Bash
Raw Normal View History

2024-07-24 03:43:21 -04:00
case $- in
2024-07-24 04:32:57 -04:00
*i*) ;;
*) return ;;
2024-07-24 03:43:21 -04:00
esac
2024-07-24 04:13:14 -04:00
# Shell options
shopt -s dotglob
shopt -s nocaseglob
shopt -s autocd
shopt -s cdspell
shopt -s histappend
shopt -s histverify
2024-07-24 03:43:21 -04:00
# Default options
alias ls='ls --color=auto -AF'
alias grep='grep --color=auto'
# Shorthands
alias l='ls'
alias c='cd'
alias v='vim'
# Other options
alias ll='ls -l'
# List files on 'cd'
cd() {
2024-07-24 04:07:40 -04:00
builtin cd "$@" && ls
2024-07-24 03:43:21 -04:00
}
# Prompt
parse_git_dirty() {
2024-07-24 15:29:18 -04:00
[ -n "$(git status --porcelain 2>/dev/null)" ] && printf "*"
2024-07-24 03:43:21 -04:00
}
parse_git_branch() {
2024-07-24 04:32:57 -04:00
git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ (\1$(parse_git_dirty))/"
2024-07-24 03:43:21 -04:00
}
export PS1="\n\[\e[36m\]\t\[\e[m\] \[\e[31m\]\h\[\e[m\] \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "