Compare commits
No commits in common. "67b2f6ed2528620153abb6658030d89c699b86dc" and "64c600f71ee6c22b88e5ba6ff9f2170e9751548a" have entirely different histories.
67b2f6ed25
...
64c600f71e
87
bashrc
87
bashrc
|
|
@ -1,28 +1,5 @@
|
||||||
# Color definitions
|
|
||||||
_WHITE='\033[1;37m' # White
|
_WHITE='\033[1;37m' # White
|
||||||
_NC='\033[0m' # Get the current day of the week, day of the month, and year
|
_NC='\033[0m' # No Color
|
||||||
day_of_week=$(date "+%A")
|
|
||||||
day_of_month=$(date "+%d")
|
|
||||||
month_name=$(date "+%B")
|
|
||||||
year=$(date "+%Y")
|
|
||||||
|
|
||||||
# Determine the day suffix (th, nd, rd)
|
|
||||||
case "$day_of_month" in
|
|
||||||
1[0-9]) day_suffix="th";;
|
|
||||||
*1) day_suffix="st";;
|
|
||||||
*2) day_suffix="nd";;
|
|
||||||
*3) day_suffix="rd";;
|
|
||||||
*) day_suffix="th";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
_RED='\033[0;31m' # Red
|
|
||||||
_GREEN='\033[01;32m' # Bright Green
|
|
||||||
_YELLOW='\033[0;33m' # Yellow
|
|
||||||
_BLUE='\033[1;34m' # Bright Blue
|
|
||||||
_BRIGHT_GREEN='\033[1;32m' # Bright Green (for positive)
|
|
||||||
_BRIGHT_RED='\033[1;31m' # Bright Red (for negative)
|
|
||||||
_BRIGHT_WHITE='\033[1;37m' # Bright White
|
|
||||||
_DIM_RED='\033[91m' # Bright Red (for TODO files)
|
|
||||||
|
|
||||||
export SHELL_CONFIG="$SHELL_CONFIG:.bashrc"
|
export SHELL_CONFIG="$SHELL_CONFIG:.bashrc"
|
||||||
#
|
#
|
||||||
|
|
@ -85,6 +62,17 @@ function show_date() {
|
||||||
# Split the selected adjective into the adjective and classification parts
|
# Split the selected adjective into the adjective and classification parts
|
||||||
IFS=':' read -r adjective classification <<< "$selected_adjective"
|
IFS=':' read -r adjective classification <<< "$selected_adjective"
|
||||||
|
|
||||||
|
# Determine the color code based on the classification
|
||||||
|
case "$classification" in
|
||||||
|
"positive") text_color="\033[1;32m";;
|
||||||
|
"negative") text_color="\033[1;31m";;
|
||||||
|
*) text_color="";; # Default to no colour
|
||||||
|
esac
|
||||||
|
|
||||||
|
# ANSI escape codes for reset
|
||||||
|
reset_color='\033[0m'
|
||||||
|
hl_color='\033[1;34m'
|
||||||
|
|
||||||
# Get the current day of the week, day of the month, and year
|
# Get the current day of the week, day of the month, and year
|
||||||
day_of_week=$(date "+%A")
|
day_of_week=$(date "+%A")
|
||||||
day_of_month=$(date "+%d")
|
day_of_month=$(date "+%d")
|
||||||
|
|
@ -100,15 +88,8 @@ function show_date() {
|
||||||
*) day_suffix="th";;
|
*) day_suffix="th";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Determine the color based on the classification
|
|
||||||
case "$classification" in
|
|
||||||
"positive") text_color="$_BRIGHT_GREEN";;
|
|
||||||
"negative") text_color="$_BRIGHT_RED";;
|
|
||||||
*) text_color="";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Create the full date format with colored parts and the selected adjective
|
# Create the full date format with colored parts and the selected adjective
|
||||||
full_date="Pray, be informed, on this ${text_color}${adjective}${_NC} day,\n${_BLUE}${day_of_week}${_NC} the ${_BLUE}${day_of_month}${day_suffix}${_NC} day of ${_BLUE}${month_name}${_NC}, in the year of our Lord ${_BLUE}${year}${_NC}!"
|
full_date="Pray, be informed, on this ${text_color}${adjective}${reset_color} day,\n${hl_color}${day_of_week}${reset_color} the ${hl_color}${day_of_month}${day_suffix}${reset_color} day of ${hl_color}${month_name}${reset_color}, in the year of our Lord ${hl_color}${year}${reset_color}!"
|
||||||
|
|
||||||
# Print the full date
|
# Print the full date
|
||||||
echo -e "$full_date"
|
echo -e "$full_date"
|
||||||
|
|
@ -119,17 +100,13 @@ function show_date() {
|
||||||
# If not running interactively, don't do anything
|
# If not running interactively, don't do anything
|
||||||
[[ $- != *i* ]] && return
|
[[ $- != *i* ]] && return
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# SHELL CONFIGURATION
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
export HISTCONTROL=ignoreboth:erasedups
|
export HISTCONTROL=ignoreboth:erasedups
|
||||||
|
|
||||||
# Load custom gitstatus configuration
|
# Load custom gitstatus configuration
|
||||||
[ -f "$HOME/.config/bash/gitstatus-custom.sh" ] && . "$HOME/.config/bash/gitstatus-custom.sh"
|
[ -f "$HOME/.config/bash/gitstatus-custom.sh" ] && . "$HOME/.config/bash/gitstatus-custom.sh"
|
||||||
|
|
||||||
# Set PS1 with time, user@host, directory on first line, git status on second line, prompt on third line
|
# Set PS1 with time, user@host, directory on first line, git status on second line, prompt on third line
|
||||||
PS1='\t \[\033[01;32m\]\u@\h\[\033[00m\] \[\033[1;34m\]\w\[\033[00m\]\n${GITSTATUS_PROMPT:+ $GITSTATUS_PROMPT\n}\[\033[01;$((31+!$?))m\]\$\[\033[00m\] \[\e]0;\u@\h: \w\a\]'
|
PS1='\t \[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]\n${GITSTATUS_PROMPT:+ $GITSTATUS_PROMPT\n}\[\033[01;$((31+!$?))m\]\$\[\033[00m\] \[\e]0;\u@\h: \w\a\]'
|
||||||
|
|
||||||
# If there are multiple matches for completion, Tab should cycle through them
|
# If there are multiple matches for completion, Tab should cycle through them
|
||||||
bind TAB:menu-complete
|
bind TAB:menu-complete
|
||||||
|
|
@ -161,45 +138,45 @@ echo -e " ${_WHITE}lftp cheat vimv 'flameshot gui' rclone mid3v2 zathura tessera
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ ${_mem_available%.*} -lt 5 ] ; then
|
if [ ${_mem_available%.*} -lt 5 ] ; then
|
||||||
echo -ne "Memory available: ${_YELLOW}"
|
echo -ne "Memory available: \033[0;33m"
|
||||||
[ ${_mem_available%.*} -lt 3 ] && echo -ne "${_RED}"
|
[ ${_mem_available%.*} -lt 3 ] && echo -ne "\033[0;31m"
|
||||||
echo -n "${_mem_available}"
|
echo -n "${_mem_available}"
|
||||||
echo -e "GB${_NC}"
|
echo -e "GB\033[0m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $_updates_available -gt 0 ] ; then
|
if [ $_updates_available -gt 0 ] ; then
|
||||||
update_color="$_BRIGHT_WHITE" # default white
|
update_color="\033[1;37m" # default white
|
||||||
if [ $_updates_available -gt 29 ] ; then
|
if [ $_updates_available -gt 29 ] ; then
|
||||||
update_color="$_RED" # red
|
update_color="\033[0;31m" # red
|
||||||
elif [ $_updates_available -gt 15 ] ; then
|
elif [ $_updates_available -gt 15 ] ; then
|
||||||
update_color="$_YELLOW" # yellow
|
update_color="\033[0;33m" # yellow
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -ne "Updates available: ${update_color}${_updates_available}${_NC}"
|
echo -ne "Updates available: ${update_color}${_updates_available}\033[0m"
|
||||||
echo -ne " [ update with: ${update_color}update${_NC} ]"
|
echo -ne " [ update with: ${update_color}update\033[0m ]"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_orphans_available="$(pacman -Qdtq 2>/dev/null | wc -l)"
|
_orphans_available="$(pacman -Qdtq 2>/dev/null | wc -l)"
|
||||||
if [ $_orphans_available -gt 0 ] ; then
|
if [ $_orphans_available -gt 0 ] ; then
|
||||||
echo -ne "Orphaned packages: $_BRIGHT_WHITE"
|
echo -ne "Orphaned packages: \033[1;37m"
|
||||||
|
|
||||||
orphan_color="$_BRIGHT_WHITE"
|
orphan_color="\033[1;37m"
|
||||||
if [ $_orphans_available -gt 9 ] ; then
|
if [ $_orphans_available -gt 9 ] ; then
|
||||||
orphan_color="$_RED"
|
orphan_color="\033[0;31m"
|
||||||
elif [ $_orphans_available -gt 4 ] ; then
|
elif [ $_orphans_available -gt 4 ] ; then
|
||||||
orphan_color="$_YELLOW"
|
orphan_color="\033[0;33m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -ne "${orphan_color}${_orphans_available}${_NC}"
|
echo -ne "${orphan_color}${_orphans_available}\033[0m"
|
||||||
echo -ne " [ remove with: ${orphan_color}sudo pacman -Rns \$(pacman -Qdtq)${_NC} ]"
|
echo -ne " [ remove with: ${orphan_color}sudo pacman -Rns \$(pacman -Qdtq)\033[0m ]"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "Remember \"${_BLUE}TODO.md${_NC}\" and \"${_BLUE}autonote.md${_NC}\" files have content automatically displayed."
|
echo -e "Remember \"\033[1;34mTODO.md\033[0m\" and \"\033[1;34mautonote.md\033[0m\" files have content automatically displayed."
|
||||||
echo -e "Edit these with ${_BLUE}et${_NC} and ${_BLUE}ea${_NC}"
|
echo -e "Edit these with \033[1;34met\033[0m and \033[1;34mea\033[0m"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
. "$HOME/.config/bash/cheat.bash"
|
. "$HOME/.config/bash/cheat.bash"
|
||||||
|
|
@ -216,7 +193,7 @@ alias backup='sudo borgmatic create --verbosity 1 --files'
|
||||||
function check_todo() {
|
function check_todo() {
|
||||||
if [ -f "TODO.md" ]; then
|
if [ -f "TODO.md" ]; then
|
||||||
echo
|
echo
|
||||||
echo -e "${_DIM_RED}TODO.md${_NC}"
|
echo -e "\e[91mTODO.md\e[0m"
|
||||||
echo "---------------------------"
|
echo "---------------------------"
|
||||||
mdcat TODO.md
|
mdcat TODO.md
|
||||||
echo "---------------------------"
|
echo "---------------------------"
|
||||||
|
|
@ -227,7 +204,7 @@ fi
|
||||||
function check_autonote() {
|
function check_autonote() {
|
||||||
if [ -f ".autonote.md" ]; then
|
if [ -f ".autonote.md" ]; then
|
||||||
echo
|
echo
|
||||||
echo -e "${_DIM_RED}autonote.md${_NC}"
|
echo -e "\e[91mautonote.md\e[0m"
|
||||||
echo "---------------------------"
|
echo "---------------------------"
|
||||||
mdcat .autonote.md
|
mdcat .autonote.md
|
||||||
echo "---------------------------"
|
echo "---------------------------"
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ function my_gitstatus_prompt_update() {
|
||||||
[[ "$VCS_STATUS_RESULT" == ok-sync ]] || return 0 # not a git repo
|
[[ "$VCS_STATUS_RESULT" == ok-sync ]] || return 0 # not a git repo
|
||||||
|
|
||||||
local reset=$'\001\e[0m\002' # no color
|
local reset=$'\001\e[0m\002' # no color
|
||||||
local bright_white=$'\001\e[1;37m\002' # bright white - branch name and modified/untracked
|
local green=$'\001\e[38;5;076m\002' # green - clean branch name
|
||||||
|
local blue=$'\001\e[38;5;014m\002' # blue - informational (untracked)
|
||||||
|
local yellow=$'\001\e[38;5;011m\002' # yellow - action pending (staged, behind/ahead)
|
||||||
local red=$'\001\e[38;5;196m\002' # red - urgent attention (conflicts, merge)
|
local red=$'\001\e[38;5;196m\002' # red - urgent attention (conflicts, merge)
|
||||||
|
|
||||||
local p
|
local p
|
||||||
|
|
@ -32,27 +34,27 @@ function my_gitstatus_prompt_update() {
|
||||||
|
|
||||||
# Truncate long branch names and tags
|
# Truncate long branch names and tags
|
||||||
(( ${#where} > 32 )) && where="${where:0:12}…${where: -12}"
|
(( ${#where} > 32 )) && where="${where:0:12}…${where: -12}"
|
||||||
p+="${bright_white}${where}"
|
p+="${green}${where}"
|
||||||
|
|
||||||
# Remote tracking status (no color - less distracting)
|
# Remote tracking status (yellow - action pending)
|
||||||
(( VCS_STATUS_COMMITS_BEHIND )) && p+=" ${reset}behind:${VCS_STATUS_COMMITS_BEHIND}"
|
(( VCS_STATUS_COMMITS_BEHIND )) && p+=" ${yellow}behind:${VCS_STATUS_COMMITS_BEHIND}"
|
||||||
(( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && p+=" "
|
(( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && p+=" "
|
||||||
(( VCS_STATUS_COMMITS_AHEAD )) && p+="${reset}ahead:${VCS_STATUS_COMMITS_AHEAD}"
|
(( VCS_STATUS_COMMITS_AHEAD )) && p+="${yellow}ahead:${VCS_STATUS_COMMITS_AHEAD}"
|
||||||
|
|
||||||
# Push remote status (no color - less distracting)
|
# Push remote status (yellow - action pending)
|
||||||
(( VCS_STATUS_PUSH_COMMITS_BEHIND )) && p+=" ${reset}push-behind:${VCS_STATUS_PUSH_COMMITS_BEHIND}"
|
(( VCS_STATUS_PUSH_COMMITS_BEHIND )) && p+=" ${yellow}push-behind:${VCS_STATUS_PUSH_COMMITS_BEHIND}"
|
||||||
(( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && p+=" "
|
(( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && p+=" "
|
||||||
(( VCS_STATUS_PUSH_COMMITS_AHEAD )) && p+="${reset}push-ahead:${VCS_STATUS_PUSH_COMMITS_AHEAD}"
|
(( VCS_STATUS_PUSH_COMMITS_AHEAD )) && p+="${yellow}push-ahead:${VCS_STATUS_PUSH_COMMITS_AHEAD}"
|
||||||
|
|
||||||
# CUSTOM: Stashes with "stash:" prefix instead of "*"
|
# CUSTOM: Stashes with "stash:" prefix instead of "*"
|
||||||
(( VCS_STATUS_STASHES )) && p+=" ${reset}stashed:${VCS_STATUS_STASHES}"
|
(( VCS_STATUS_STASHES )) && p+=" ${reset}stashed:${VCS_STATUS_STASHES}"
|
||||||
|
|
||||||
# Repository state and file counts (minimal colors)
|
# Repository state and file counts (descriptive labels)
|
||||||
[[ -n "$VCS_STATUS_ACTION" ]] && p+=" ${red}${VCS_STATUS_ACTION}"
|
[[ -n "$VCS_STATUS_ACTION" ]] && p+=" ${red}${VCS_STATUS_ACTION}"
|
||||||
(( VCS_STATUS_NUM_CONFLICTED )) && p+=" ${red}conflicts:${VCS_STATUS_NUM_CONFLICTED}"
|
(( VCS_STATUS_NUM_CONFLICTED )) && p+=" ${red}conflicts:${VCS_STATUS_NUM_CONFLICTED}"
|
||||||
(( VCS_STATUS_NUM_STAGED )) && p+=" ${reset}staged:${VCS_STATUS_NUM_STAGED}"
|
(( VCS_STATUS_NUM_STAGED )) && p+=" ${yellow}staged:${VCS_STATUS_NUM_STAGED}"
|
||||||
(( VCS_STATUS_NUM_UNSTAGED )) && p+=" ${bright_white}modified:${VCS_STATUS_NUM_UNSTAGED}"
|
(( VCS_STATUS_NUM_UNSTAGED )) && p+=" ${yellow}modified:${VCS_STATUS_NUM_UNSTAGED}"
|
||||||
(( VCS_STATUS_NUM_UNTRACKED )) && p+=" ${bright_white}untracked:${VCS_STATUS_NUM_UNTRACKED}"
|
(( VCS_STATUS_NUM_UNTRACKED )) && p+=" ${blue}untracked:${VCS_STATUS_NUM_UNTRACKED}"
|
||||||
|
|
||||||
GITSTATUS_PROMPT="${p}${reset}"
|
GITSTATUS_PROMPT="${p}${reset}"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue