From cc352d70fa1018cdcc3dea2982762e0d3d475eb5 Mon Sep 17 00:00:00 2001 From: kj_sh604 Date: Sun, 28 Dec 2025 23:26:34 -0500 Subject: refactor: consolidate changes to git-prompts/kj_sh604.zsh --- .config/shell/.zshrc | 2 +- .../kj_sh604-with-attempt-at-fish-style-pwd.zsh | 64 ---------------------- .config/shell/git-prompts/kj_sh604.zsh | 45 ++++++++++++++- 3 files changed, 45 insertions(+), 66 deletions(-) delete mode 100644 .config/shell/git-prompts/kj_sh604-with-attempt-at-fish-style-pwd.zsh diff --git a/.config/shell/.zshrc b/.config/shell/.zshrc index de6dfb6..2c7b8f9 100644 --- a/.config/shell/.zshrc +++ b/.config/shell/.zshrc @@ -10,7 +10,7 @@ ensure_directory_and_file() { setopt prompt_subst source_if_exists ~/.config/shell/git-prompt.zsh -source_if_exists ~/.config/shell/git-prompts/kj_sh604-with-attempt-at-fish-style-pwd.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 diff --git a/.config/shell/git-prompts/kj_sh604-with-attempt-at-fish-style-pwd.zsh b/.config/shell/git-prompts/kj_sh604-with-attempt-at-fish-style-pwd.zsh deleted file mode 100644 index d704782..0000000 --- a/.config/shell/git-prompts/kj_sh604-with-attempt-at-fish-style-pwd.zsh +++ /dev/null @@ -1,64 +0,0 @@ -ZSH_GIT_PROMPT_FORCE_BLANK=1 -ZSH_GIT_PROMPT_SHOW_UPSTREAM="yes" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_no_bold[white]%}(" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_no_bold[white]%}) " -ZSH_THEME_GIT_PROMPT_SEPARATOR=" " -ZSH_THEME_GIT_PROMPT_DETACHED="%{$fg_no_bold[cyan]%}:" -ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_no_bold[magenta]%}" -ZSH_THEME_GIT_PROMPT_UPSTREAM_SYMBOL="%{$fg_bold[yellow]%}^ " -ZSH_THEME_GIT_PROMPT_UPSTREAM_PREFIX="%{$fg[red]%}(%{$fg[yellow]%}" -ZSH_THEME_GIT_PROMPT_UPSTREAM_SUFFIX="%{$fg[red]%})" -ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg_no_bold[white]%}↓" -ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_no_bold[white]%}↑" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[red]%}x" -ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[yellow]%}•" -ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg[blue]%}+" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}U" -ZSH_THEME_GIT_PROMPT_STASHED="%{$fg[blue]%}☐" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓" - -__fish_pwd() { - local pwd="${PWD/#$HOME/~}" - - if [[ "$pwd" == "~" ]]; then - echo "~" - return - fi - - local -a parts - - parts=("${(@s:/:)pwd}") - - if [[ -z "${parts[1]}" ]]; then - parts=("${parts[@]:1}") - local prefix="/" - else - local prefix="" - fi - - if (( ${#parts[@]} <= 1 )); then - echo "${prefix}${parts[1]}" - return - fi - - local result="" - local i - - for (( i=1; i < ${#parts[@]}; i++ )); do - local part="${parts[$i]}" - if [[ "$part" == "~" ]]; then - result+="~/" - elif [[ "$part" == .* ]]; then - result+="${part:0:2}/" - else - result+="${part:0:1}/" - fi - done - - result+="${parts[-1]}" - - echo "${prefix}${result}" -} - -PROMPT=$'%F{cyan}$(__fish_pwd)%f %F{242}$(gitprompt)%f%(12V.%F{242}%12v%f .)%(?.%F{white}.%F{white})%%%f ' \ No newline at end of file diff --git a/.config/shell/git-prompts/kj_sh604.zsh b/.config/shell/git-prompts/kj_sh604.zsh index efdf4af..8cdb9e0 100644 --- a/.config/shell/git-prompts/kj_sh604.zsh +++ b/.config/shell/git-prompts/kj_sh604.zsh @@ -18,4 +18,47 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}U" ZSH_THEME_GIT_PROMPT_STASHED="%{$fg[blue]%}☐" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓" -PROMPT=$'%F{cyan}%~%f %F{242}$(gitprompt)%f%(12V.%F{242}%12v%f .)%(?.%F{white}.%F{white})%%%f ' +__fish_pwd() { + local pwd="${PWD/#$HOME/~}" + + if [[ "$pwd" == "~" ]]; then + echo "~" + return + fi + + local -a parts + + parts=("${(@s:/:)pwd}") + + if [[ -z "${parts[1]}" ]]; then + parts=("${parts[@]:1}") + local prefix="/" + else + local prefix="" + fi + + if (( ${#parts[@]} <= 1 )); then + echo "${prefix}${parts[1]}" + return + fi + + local result="" + local i + + for (( i=1; i < ${#parts[@]}; i++ )); do + local part="${parts[$i]}" + if [[ "$part" == "~" ]]; then + result+="~/" + elif [[ "$part" == .* ]]; then + result+="${part:0:2}/" + else + result+="${part:0:1}/" + fi + done + + result+="${parts[-1]}" + + echo "${prefix}${result}" +} + +PROMPT=$'%F{cyan}$(__fish_pwd)%f %F{242}$(gitprompt)%f%(12V.%F{242}%12v%f .)%(?.%F{white}.%F{white})%%%f ' -- cgit v1.2.3