From 70532272be7010f2480f39cf0b9e2038b8cdfef7 Mon Sep 17 00:00:00 2001 From: kj-sh604 Date: Wed, 17 Jul 2024 22:37:16 -0400 Subject: refactor: improve readability --- .config/shell/.bashrc | 30 ++++++++++++++++-------------- .config/shell/.zshrc | 5 ++--- 2 files changed, 18 insertions(+), 17 deletions(-) (limited to '.config/shell') diff --git a/.config/shell/.bashrc b/.config/shell/.bashrc index 286afd9..8782090 100644 --- a/.config/shell/.bashrc +++ b/.config/shell/.bashrc @@ -1,6 +1,21 @@ # note: this file needs to be sourced in /etc/bash.bashrc -. ~/.config/shell/git-prompt.sh +# personal QOL functions +source_if_exists() { + [ -f "$1" ] && source "$1" +} + +ensure_directory_and_file() { + [ ! -d "$1" ] && mkdir -p "$1" + [ ! -f "$2" ] && touch "$2" +} + +# Source personal POSIX functions +source_if_exists ~/.config/shell/posix-functions/create_POSIX_dotenv.sh +source_if_exists ~/.config/shell/posix-functions/POSIX_open.sh + +# git prompt +source_if_exists ~/.config/shell/git-prompt.sh export GIT_PS1_SHOWDIRTYSTATE=1 if [[ $- != *i* ]] ; then @@ -71,17 +86,4 @@ done unset use_color sh -source_if_exists() { - [ -f "$1" ] && source "$1" -} - -ensure_directory_and_file() { - [ ! -d "$1" ] && mkdir -p "$1" - [ ! -f "$2" ] && touch "$2" -} - -# Source personal POSIX functions -source_if_exists ~/.config/shell/posix-functions/create_POSIX_dotenv.sh -source_if_exists ~/.config/shell/posix-functions/POSIX_open.sh - export HISTFILE="$XDG_STATE_HOME"/shell/history diff --git a/.config/shell/.zshrc b/.config/shell/.zshrc index 47a0922..d62af2e 100644 --- a/.config/shell/.zshrc +++ b/.config/shell/.zshrc @@ -1,3 +1,4 @@ +# personal QOL functions source_if_exists() { [ -f "$1" ] && source "$1" } @@ -7,15 +8,13 @@ ensure_directory_and_file() { [ ! -f "$2" ] && touch "$2" } - source_if_exists ~/.config/shell/git-prompt.zsh source_if_exists ~/.config/shell/git-prompts/kj_sh604.zsh source_if_exists ~/.config/shell/zsh-autosuggestions/zsh-autosuggestions.zsh source_if_exists ~/.config/shell/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh source_if_exists ~/.config/shell/zsh-history-substring-search/zsh-history-substring-search.zsh -# source_if_exists ~/.config/shell/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -# Source personal POSIX functions +# source personal posix functions source_if_exists ~/.config/shell/posix-functions/create_POSIX_dotenv.sh source_if_exists ~/.config/shell/posix-functions/POSIX_open.sh -- cgit v1.2.3