diff options
| author | kj_sh604 | 2025-12-28 23:26:34 -0500 |
|---|---|---|
| committer | kj_sh604 | 2025-12-28 23:26:34 -0500 |
| commit | cc352d70fa1018cdcc3dea2982762e0d3d475eb5 (patch) | |
| tree | ce81089868adfcce02e3fe115e929eceb9fd23d1 | |
| parent | f3b379dcdde48b80dc59664616157d4e38f6c447 (diff) | |
refactor: consolidate changes to git-prompts/kj_sh604.zsh
| -rw-r--r-- | .config/shell/.zshrc | 2 | ||||
| -rw-r--r-- | .config/shell/git-prompts/kj_sh604-with-attempt-at-fish-style-pwd.zsh | 64 | ||||
| -rw-r--r-- | .config/shell/git-prompts/kj_sh604.zsh | 45 |
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 | ||
| 11 | setopt prompt_subst | 11 | setopt prompt_subst |
| 12 | source_if_exists ~/.config/shell/git-prompt.zsh | 12 | source_if_exists ~/.config/shell/git-prompt.zsh |
| 13 | source_if_exists ~/.config/shell/git-prompts/kj_sh604-with-attempt-at-fish-style-pwd.zsh | 13 | source_if_exists ~/.config/shell/git-prompts/kj_sh604.zsh |
| 14 | source_if_exists ~/.config/shell/zsh-autosuggestions/zsh-autosuggestions.zsh | 14 | source_if_exists ~/.config/shell/zsh-autosuggestions/zsh-autosuggestions.zsh |
| 15 | source_if_exists ~/.config/shell/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh | 15 | source_if_exists ~/.config/shell/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh |
| 16 | source_if_exists ~/.config/shell/zsh-history-substring-search/zsh-history-substring-search.zsh | 16 | 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 @@ | |||
| 1 | ZSH_GIT_PROMPT_FORCE_BLANK=1 | ||
| 2 | ZSH_GIT_PROMPT_SHOW_UPSTREAM="yes" | ||
| 3 | |||
| 4 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_no_bold[white]%}(" | ||
| 5 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_no_bold[white]%}) " | ||
| 6 | ZSH_THEME_GIT_PROMPT_SEPARATOR=" " | ||
| 7 | ZSH_THEME_GIT_PROMPT_DETACHED="%{$fg_no_bold[cyan]%}:" | ||
| 8 | ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_no_bold[magenta]%}" | ||
| 9 | ZSH_THEME_GIT_PROMPT_UPSTREAM_SYMBOL="%{$fg_bold[yellow]%}^ " | ||
| 10 | ZSH_THEME_GIT_PROMPT_UPSTREAM_PREFIX="%{$fg[red]%}(%{$fg[yellow]%}" | ||
| 11 | ZSH_THEME_GIT_PROMPT_UPSTREAM_SUFFIX="%{$fg[red]%})" | ||
| 12 | ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg_no_bold[white]%}↓" | ||
| 13 | ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_no_bold[white]%}↑" | ||
| 14 | ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[red]%}x" | ||
| 15 | ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[yellow]%}•" | ||
| 16 | ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg[blue]%}+" | ||
| 17 | ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}U" | ||
| 18 | ZSH_THEME_GIT_PROMPT_STASHED="%{$fg[blue]%}☐" | ||
| 19 | ZSH_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 | |||
| 64 | 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" | |||
| 18 | ZSH_THEME_GIT_PROMPT_STASHED="%{$fg[blue]%}☐" | 18 | ZSH_THEME_GIT_PROMPT_STASHED="%{$fg[blue]%}☐" |
| 19 | ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓" | 19 | ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓" |
| 20 | 20 | ||
| 21 | PROMPT=$'%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 | |||
| 64 | PROMPT=$'%F{cyan}$(__fish_pwd)%f %F{242}$(gitprompt)%f%(12V.%F{242}%12v%f .)%(?.%F{white}.%F{white})%%%f ' | ||
