dotfiles/shell/bashrc
2023-09-15 13:13:53 -06:00

45 lines
1.6 KiB
Bash

#!/bin/bash
# tavo custom bashrc file
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Prompt
prompt_git_branch() {
GIT_BRANCH="$(git branch 2>/dev/null | grep '*' | cut -d ' ' -f 2)"
[ -n "$GIT_BRANCH" ] && printf "  %s " "$GIT_BRANCH"
}
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
PATH="$HOME/.config/scripts/status${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts/menu${PATH:+:${PATH}}"
PATH="$HOME/.config/wrappers${PATH:+:${PATH}}"
PATH="$HOME/.config/scripts${PATH:+:${PATH}}"
PATH="$HOME/.local/bin${PATH:+:${PATH}}" # Custom PATHs for executables
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
source ~/.config/shell/xdgspec
source ~/.config/shell/envvar
source ~/.config/shell/aliasrc
source ~/.config/shell/functions
# Binds
bind '"\C-f":"fzf_nav\C-m"'
bind '"\C-y":"copy_output\C-m"'
bind '"\C-e":"dragon -x \* 2>/dev/null\C-m"'
# Autostart dwm after tty login
type systemctl 2>/dev/null 1>&2 && if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
cat ~/.config/snippets/welcome
sleep 0.5
amixer
exec startx
fi
# nice login prompt
[ -e "/usr/bin/afetch" ] && afetch || fetch min