diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-02-21 17:11:05 -0500 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-02-21 17:11:05 -0500 |
| commit | 960a05363ae9c0b767d57405cfffe9f8a6b021cd (patch) | |
| tree | 41aca6d3abd2aa7408b2c24f4f9ff0c08ad475cb /.config/shells/zsh/.zshrc | |
| parent | 8276fb9c65e40605f7d56dac3326b3f9f90c615d (diff) | |
refactor(zsh): Restructured common shell files
Restructured common shell files to be in a utils directory. Operating
System specific files are in the util/OS_NAME/ directories.
Diffstat (limited to '.config/shells/zsh/.zshrc')
| -rw-r--r-- | .config/shells/zsh/.zshrc | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/.config/shells/zsh/.zshrc b/.config/shells/zsh/.zshrc index b9c5a1f..652d12f 100644 --- a/.config/shells/zsh/.zshrc +++ b/.config/shells/zsh/.zshrc @@ -2,33 +2,24 @@ if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && exec tmux fi -color_wrap() { - printf "%s%s%s" %{$fg_bold[$1]%} $2 %{$reset_color%} -} - -git_good() { - REPO="$(git config --get remote.origin.url 2>/dev/null | sed -n -E 's|.*/(.*)\.git|\1|p' | tr -d '\n' )" - BRANCH="$(git branch 2>/dev/null | sed -n -E 's/\* (.*)/\1/p' | tr -d '\n')" - [[ -n $BRANCH ]] && color_wrap cyan "[$REPO::$BRANCH] " -} - -error_code() { - if [[ $1 != 0 ]]; - then - color_wrap red "["$1"]" - fi -} - source ~/.zprofile export SHELLDIR="$XDG_CONFIG_HOME/shells" export ZSH="$SHELLDIR/zsh" autoload -U +X compinit -compinit -d $XDG_CACHE_HOME/zcompdump-artix-5.8 +compinit -d $XDG_CACHE_HOME/zcompdump fpath=($ZSH/plugins/zsh-completions/src $fpath) -source $SHELLDIR/aliasrc -source $SHELLDIR/dirrc -source $SHELLDIR/colorsrc # contians color substituions -source $SHELLDIR/cpwdrc # contains _collapsed_pwd + +for CONFIG_FILE in $SHELLDIR/utils/*; +do + [[ -f $CONFIG_FILE ]] && source $CONFIG_FILE +done + +export OS="$(uname -s)" +for CONFIG_FILE in $SHELLDIR/utils/$OS/*; +do + [[ -f $CONFIG_FILE ]] && source $CONFIG_FILE +done + bindkey -v bindkey -s ^f "tmux-sessionizer\n" HISTFILE="$XDG_CACHE_HOME/zshHIST" @@ -36,9 +27,8 @@ SAVEHIST=100 HISTSIZE=5000 setopt prompt_subst autoload -U colors && colors -PROMPT='%{$fg_bold[$shColor]%}$comSym%{$reset_color%} in %{$fg_bold[$shColor]%}%c%{$reset_color%} $(ret=$?; git_good ; error_code $ret) +PROMPT='%{$fg_bold[$shColor]%}$comSym%{$reset_color%} in %{$fg_bold[$shColor]%}%~%{$reset_color%} $(ret=$?; git_good ; error_code $ret) → ' source $ZSH/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh source $ZSH/plugins/fzf-tab/fzf-tab.zsh -source $SHELLDIR/funcrc |
