chore(shellrc): update bashrc and profile to load up $GOPATH/bin

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.xyz>
This commit is contained in:
Andrei Jiroh Halili 2024-08-17 14:34:58 +08:00
parent b7c40c5e5f
commit 0658bee1be
No known key found for this signature in database
GPG key ID: 67BFC91B3DA12BE8
3 changed files with 24 additions and 40 deletions

30
.bashrc
View file

@ -24,19 +24,6 @@ if [ -f "$HOME/.config/localconfig.env" ]; then
. "$HOME/.config/localconfig.env"
fi
if command -v oh-my-posh >>/dev/null && [[ $FF_USE_OHMYPOSH != "false" ]]; then
eval "$(oh-my-posh init bash)"
else
if [[ $PROMPT_THEME == "disabled" ]]; then
true
elif [[ -f "$HOME/.config/bash/shell-prompts/${PROMPT_THEME}.bashrc" ]]; then
# shellcheck disable=SC1090
source "$HOME/.config/bash/shell-prompts/${PROMPT_THEME}.bashrc"
else
source "$HOME/.config/bash/shell-prompts/vern.bashrc"
fi
fi
## Stage 1: Init custom vars and shortcuts before anything else ##
## Note that ~/.env and ~/.env.local should be loaded eariler on ##
# Dotfiles stuff, maybe should be on ~/.env?
@ -45,6 +32,7 @@ export DOTFILES_BIN="$DOTFILES_HOME/bin"
# gopath should be on ~/.local/share/go to not fuck up with local install
# at ~/go if exists
export GOPATH="$HOME/.local/share/go"
export PATH="${GOPATH}/bin:${PATH}"
# Shut up, VS Code (not the OSS distributions off github:microsoft/vscode).
# Don't let me pay for JetBrains IDEs or go nuts with nvim (or emacs, since
# I'm both a bit neutral and off the rails at Vim vs Emacs debate). Also RIP
@ -63,18 +51,4 @@ if [[ -d "$HOME/.bashbox" ]]; then
source "$HOME/.bashbox/env"
fi
# Formerly: handle hostname generation for importing host-specific configs
# TODO: Handle detection across distributions without chaos, especially where
# Nix is installed (not NixOS)
if [[ $WSL_DISTRO_NAME ]] && [[ $WSL_INTEROP ]]; then
HOSTNAME_BASH="$(cat /etc/hostname)-wsl-${WSL_DISTRO_NAME}"
export WSL=1 # similar to CODESPACES and GITPOD_WORKSPACE_ID vars
else
HOSTNAME_BASH="$(cat /etc/hostname)"
fi
export HOSTNAME_BASH
for file in "$HOME/.config/bash/hosts/${HOSTNAME_BASH}.bashrc" "${HOME}/.config/bash/bashrc"; do
# shellcheck disable=SC1090
[ -f "$file" ] && . "$file"
done
source "$HOME/.config/bash/bashrc"

View file

@ -3,10 +3,10 @@
# for examples
# If not running interactively, don't do anything
#case $- in
# *i*) ;;
# *) return;;
#esac
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
@ -52,13 +52,18 @@ if [ -n "$force_color_prompt" ]; then
fi
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
if command -v oh-my-posh >>/dev/null && [[ $FF_USE_OHMYPOSH != "false" ]]; then
eval "$(oh-my-posh init bash)"
else
if [[ $PROMPT_THEME == "disabled" ]]; then
true
elif [[ -f "$HOME/.config/bash/shell-prompts/${PROMPT_THEME}.bashrc" ]]; then
# shellcheck disable=SC1090
source "$HOME/.config/bash/shell-prompts/${PROMPT_THEME}.bashrc"
else
source "$HOME/.config/bash/shell-prompts/vern.bashrc"
fi
fi
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
@ -82,3 +87,6 @@ if ! shopt -oq posix; then
. /etc/bash_completion
fi
fi
[ -f "${HOME}/.config/bash/hosts/${HOSTNAME_BASH}.bashrc" ] \
&& . "${HOME}/.config/bash/hosts/${HOSTNAME_BASH}.bashrc"

View file

@ -27,7 +27,9 @@ if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
export PATH="/usr/local/bin:$HOME/.local/bin:$HOME/bin${PATH:+:}$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts" # ~vern specifics and more
# Add $GOPATH/bin into PATH
export GOPATH="$HOME/.local/share/go"
export PATH="$GOPATH/bin:$PATH"
mesg n 2> /dev/null || true
# then import the rest