109 lines
2.9 KiB
Bash
109 lines
2.9 KiB
Bash
#! /bin/bash
|
|
# Note, I don't really use bash so this may be kinda sparse, but you may be able to copy stuff from .zshrc
|
|
|
|
# Source global definitions
|
|
if [ -f /etc/bashrc ]; then
|
|
. /etc/bashrc
|
|
fi
|
|
|
|
checkCommand(){
|
|
type "$1" >/dev/null 2>&1
|
|
}
|
|
|
|
# # If you have zellij installed, this will auto start it
|
|
# if [ -z "$ZELLIJ" ] && checkCommand zellij; then
|
|
# #export ZELLIJ_AUTO_ATTACH=true
|
|
# exec zellij
|
|
# fi
|
|
|
|
# Speed up shell load on WSL
|
|
OLDPATH=$PATH
|
|
PATH=$(echo "$PATH" | sed -e 's/\/mnt\/.*\?://g')
|
|
|
|
|
|
# enable programmable completion features (you don't need to enable
|
|
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
|
# sources /etc/bash.bashrc).
|
|
if ! shopt -oq posix; then
|
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
|
. /usr/share/bash-completion/bash_completion
|
|
elif [ -f /etc/bash_completion ]; then
|
|
. /etc/bash_completion
|
|
fi
|
|
fi
|
|
|
|
# check the window size after each command and, if necessary,
|
|
# update the values of LINES and COLUMNS.
|
|
shopt -s checkwinsize
|
|
|
|
# don't put duplicate lines or lines starting with space in the history.
|
|
# See bash(1) for more options
|
|
HISTCONTROL=ignoreboth
|
|
|
|
# append to the history file, don't overwrite it
|
|
shopt -s histappend
|
|
|
|
|
|
# Shell Agnostic Env Vars
|
|
[[ -f ~/.env ]] && . ~/.env
|
|
|
|
# Load Aliases
|
|
[[ -f ~/.aliasrc ]] && . ~/.aliasrc
|
|
|
|
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
|
HISTSIZE=10000
|
|
HISTFILESIZE=10000
|
|
HISTFILE="${XDG_STATE_HOME}/bash/history"
|
|
|
|
# set colors if pywal is installed
|
|
if checkCommand wal && [ -z "$SSH_TTY" ]; then
|
|
eval 'cat ~/.cache/wal/sequences &'
|
|
fi
|
|
|
|
# Load sheldon
|
|
#if checkCommand sheldon; then
|
|
# eval "$(sheldon -q source)";
|
|
|
|
|
|
# if ssh-agent isn't running, run it
|
|
if ! pgrep -u "$USER" '(ssh|gpg)-agent' >/dev/null; then
|
|
if checkCommand gpg-agent; then
|
|
gpg-agent --daemon --enable-ssh-support;
|
|
unset SSH_AGENT_PID;
|
|
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-socket);
|
|
export GPG_TTY=$(tty)
|
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
|
elif checkCommand ssh-agent; then
|
|
ssh-agent > "$HOME/.ssh-agent.env";
|
|
fi
|
|
fi
|
|
if [ ! -f "$SSH_AUTH_SOCK" ] && [ -f ~/.ssh-agent.env ]; then
|
|
source "$HOME/.ssh-agent.env" >/dev/null
|
|
fi
|
|
|
|
# Set up mcfly if installed (lets you search through history easily with ctrl+r)
|
|
if command -v mcfly >/dev/null 2>&1; then
|
|
eval "$(mcfly init bash)"
|
|
fi
|
|
|
|
|
|
# set up zoxide if installed (lets you jump through folders easily using the z and zi commands instead of cd)
|
|
if command -v zoxide >/dev/null 2>&1; then
|
|
eval "$(zoxide init bash)"
|
|
fi
|
|
|
|
[[ -f "$HOME"/.config/broot/launcher/bash/br ]] && source "$HOME"/.config/broot/launcher/bash/br
|
|
|
|
if checkCommand hyfetch; then
|
|
hyfetch -b fastfetch
|
|
fi
|
|
|
|
if checkCommand starship; then
|
|
eval "$(starship init $0)";
|
|
else #Fallback prompt
|
|
PS1='[\u@\h \W]\$ ';
|
|
fi
|
|
PATH=$OLDPATH
|
|
unset OLDPATH
|
|
|
|
# export UUID=552fbc4c-1e9b-11b2-a85c-a01fe49e12ee
|