lots of qol stuff in bashrc

This commit is contained in:
frosty 2024-07-24 15:57:46 -04:00
parent 675b6710ea
commit 846af1d8e8

59
.bashrc
View file

@ -14,14 +14,39 @@ shopt -s histverify
# Default options
alias ls='ls --color=auto -AF'
alias grep='grep --color=auto'
alias wget='wget --no-hsts'
# Shorthands
alias l='ls'
alias c='cd'
alias v='vim'
alias d='docker'
alias f='fastfetch'
alias g='git'
# Other options
# Other options and commands
alias ll='ls -l'
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias dc='docker compose'
# Common files and directories
alias M='cd ~/compose'
alias D='cd ~/dotfiles'
alias S='cd ~/.ssh'
C() {
case "$HOSTNAME" in
blizzard) cd ~/compose/caddy ;;
*) printf '%s' "Did you mean to be on blizzard?" ;;
esac
}
alias R='vim ~/.bashrc'
alias P='vim ~/.bash_profile'
alias V='vim ~/.vim/vimrc'
alias G='vim ~/.gitconfig'
# List files on 'cd'
cd() {
@ -34,7 +59,37 @@ parse_git_dirty() {
}
parse_git_branch() {
git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ (\1$(parse_git_dirty))/"
command -v git >/dev/null 2>&1 || return
while IFS= read -r line; do
[ -z "$line" ] && return
printf '%s' " (${line#* }$(parse_git_dirty))"
done <<EOF
$(git branch --no-color 2>/dev/null)
EOF
}
export PS1="\n\[\e[36m\]\t\[\e[m\] \[\e[31m\]\h\[\e[m\] \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
# Startup screen
clear
case "$HOSTNAME" in
blizzard)
printf '%s' "\
_ _ _ _
| |__ | (_)__________ _ _ __ __| |
| '_ \\| | |_ /_ / _\` | '__/ _\` |
| |_) | | |/ / / / (_| | | | (_| |
|_.__/|_|_/___/___\\__,_|_| \\__,_|
"
;;
glacier)
printf '%s' "\
_ _
__ _| | __ _ ___(_) ___ _ __
/ _\` | |/ _\` |/ __| |/ _ \\ '__|
| (_| | | (_| | (__| | __/ |
\\__, |_|\\__,_|\\___|_|\\___|_|
|___/
"
;;
esac