dotfiles/shell/bashrc
2023-11-28 09:49:01 -06:00

33 lines
1.6 KiB
Bash

#!/bin/bash
# tavo custom bashrc file
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# git branch
prompt_git_branch() {
GIT_BRANCH="$(git branch 2>/dev/null | sed '/\*/!d;s/^\*\s*//g;s/\s*$//g')"
[ -n "$GIT_BRANCH" ] && printf "%s " "$GIT_BRANCH"
}
PS1='\[\033[2m\]($?)\[\033[0m\]\[\033[1m\]\[\033[36m\] \u@\h \[\033[34m\]\w \[\033[35m\]$(prompt_git_branch)\[\033[0m\]\[\033[2m\][\!] \@\n\[\033[0m\]\[\033[2m\]$\[\033[0m\] '
# Alt PS1 with background
#PS1='\[\033[2m\]($?) \[\033[1m\]\[\033[46m\] \u@\h \[\033[44m\] \w \[\033[45m\]$(prompt_git_branch)\[\033[0m\] \[\033[2m\][\!] \@\n\[\033[0m\]⯈ '
PROMPT_COMMAND="echo" # Line jump after every command
# General configs
bind "set completion-ignore-case on" # Case insensitive TAB complete
shopt -s cdspell # Autocorrect directory name
shopt -s autocd # cd into dir by typing the name
set -o vi # vi mode
# External configs
[ -e "$HOME/.config/shell/posix-kit" ] && source ~/.config/shell/posix-kit
[ -e "$HOME/.config/shell/functions" ] && source ~/.config/shell/functions
[ -e "$HOME/.config/shell/keybinds" ] && source ~/.config/shell/keybinds
[ -e "$HOME/.config/shell/xdgspec" ] && source ~/.config/shell/xdgspec
[ -e "$HOME/.config/shell/aliasrc" ] && source ~/.config/shell/aliasrc
[ -e "$HOME/.config/shell/envvar" ] && source ~/.config/shell/envvar
[ -e "$HOME/.config/shell/dwm" ] && source ~/.config/shell/dwm
# Nice shell welcome
[ -e "/usr/bin/afetch" ] && (afetch && echo && ls) || (fetch min && echo && ls) 2>/dev/null