summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkj_sh6042025-12-28 23:26:34 -0500
committerkj_sh6042025-12-28 23:26:34 -0500
commitcc352d70fa1018cdcc3dea2982762e0d3d475eb5 (patch)
treece81089868adfcce02e3fe115e929eceb9fd23d1
parentf3b379dcdde48b80dc59664616157d4e38f6c447 (diff)
refactor: consolidate changes to git-prompts/kj_sh604.zsh
-rw-r--r--.config/shell/.zshrc2
-rw-r--r--.config/shell/git-prompts/kj_sh604-with-attempt-at-fish-style-pwd.zsh64
-rw-r--r--.config/shell/git-prompts/kj_sh604.zsh45
3 files changed, 45 insertions, 66 deletions
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() {
10 10
11setopt prompt_subst 11setopt prompt_subst
12source_if_exists ~/.config/shell/git-prompt.zsh 12source_if_exists ~/.config/shell/git-prompt.zsh
13source_if_exists ~/.config/shell/git-prompts/kj_sh604-with-attempt-at-fish-style-pwd.zsh 13source_if_exists ~/.config/shell/git-prompts/kj_sh604.zsh
14source_if_exists ~/.config/shell/zsh-autosuggestions/zsh-autosuggestions.zsh 14source_if_exists ~/.config/shell/zsh-autosuggestions/zsh-autosuggestions.zsh
15source_if_exists ~/.config/shell/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 15source_if_exists ~/.config/shell/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
16source_if_exists ~/.config/shell/zsh-history-substring-search/zsh-history-substring-search.zsh 16source_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 @@
1ZSH_GIT_PROMPT_FORCE_BLANK=1
2ZSH_GIT_PROMPT_SHOW_UPSTREAM="yes"
3
4ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_no_bold[white]%}("
5ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_no_bold[white]%}) "
6ZSH_THEME_GIT_PROMPT_SEPARATOR=" "
7ZSH_THEME_GIT_PROMPT_DETACHED="%{$fg_no_bold[cyan]%}:"
8ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_no_bold[magenta]%}"
9ZSH_THEME_GIT_PROMPT_UPSTREAM_SYMBOL="%{$fg_bold[yellow]%}^ "
10ZSH_THEME_GIT_PROMPT_UPSTREAM_PREFIX="%{$fg[red]%}(%{$fg[yellow]%}"
11ZSH_THEME_GIT_PROMPT_UPSTREAM_SUFFIX="%{$fg[red]%})"
12ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg_no_bold[white]%}↓"
13ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_no_bold[white]%}↑"
14ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[red]%}x"
15ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[yellow]%}•"
16ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg[blue]%}+"
17ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}U"
18ZSH_THEME_GIT_PROMPT_STASHED="%{$fg[blue]%}☐"
19ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓"
20
21__fish_pwd() {
22 local pwd="${PWD/#$HOME/~}"
23
24 if [[ "$pwd" == "~" ]]; then
25 echo "~"
26 return
27 fi
28
29 local -a parts
30
31 parts=("${(@s:/:)pwd}")
32
33 if [[ -z "${parts[1]}" ]]; then
34 parts=("${parts[@]:1}")
35 local prefix="/"
36 else
37 local prefix=""
38 fi
39
40 if (( ${#parts[@]} <= 1 )); then
41 echo "${prefix}${parts[1]}"
42 return
43 fi
44
45 local result=""
46 local i
47
48 for (( i=1; i < ${#parts[@]}; i++ )); do
49 local part="${parts[$i]}"
50 if [[ "$part" == "~" ]]; then
51 result+="~/"
52 elif [[ "$part" == .* ]]; then
53 result+="${part:0:2}/"
54 else
55 result+="${part:0:1}/"
56 fi
57 done
58
59 result+="${parts[-1]}"
60
61 echo "${prefix}${result}"
62}
63
64PROMPT=$'%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"
18ZSH_THEME_GIT_PROMPT_STASHED="%{$fg[blue]%}☐" 18ZSH_THEME_GIT_PROMPT_STASHED="%{$fg[blue]%}☐"
19ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓" 19ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓"
20 20
21PROMPT=$'%F{cyan}%~%f %F{242}$(gitprompt)%f%(12V.%F{242}%12v%f .)%(?.%F{white}.%F{white})%%%f ' 21__fish_pwd() {
22 local pwd="${PWD/#$HOME/~}"
23
24 if [[ "$pwd" == "~" ]]; then
25 echo "~"
26 return
27 fi
28
29 local -a parts
30
31 parts=("${(@s:/:)pwd}")
32
33 if [[ -z "${parts[1]}" ]]; then
34 parts=("${parts[@]:1}")
35 local prefix="/"
36 else
37 local prefix=""
38 fi
39
40 if (( ${#parts[@]} <= 1 )); then
41 echo "${prefix}${parts[1]}"
42 return
43 fi
44
45 local result=""
46 local i
47
48 for (( i=1; i < ${#parts[@]}; i++ )); do
49 local part="${parts[$i]}"
50 if [[ "$part" == "~" ]]; then
51 result+="~/"
52 elif [[ "$part" == .* ]]; then
53 result+="${part:0:2}/"
54 else
55 result+="${part:0:1}/"
56 fi
57 done
58
59 result+="${parts[-1]}"
60
61 echo "${prefix}${result}"
62}
63
64PROMPT=$'%F{cyan}$(__fish_pwd)%f %F{242}$(gitprompt)%f%(12V.%F{242}%12v%f .)%(?.%F{white}.%F{white})%%%f '