Skip to content

Commit

Permalink
feat(cwd,root): -1 shows entire path
Browse files Browse the repository at this point in the history
# Conflicts:
#	git-prompt-kit.zsh
#	git-prompt-kit.zsh.zwc

# Conflicts:
#	git-prompt-kit.zsh.zwc
  • Loading branch information
olets committed Jan 17, 2022
1 parent 8de45aa commit 63bdab6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ Name | Type | Description | Default

Name | Type | Description | Default
---|---|---|---
`GIT_PROMPT_KIT_CWD_TRAILING_COUNT` | integer | The maximum number of trailing path components in the current working directory component. When in a Git repository, this is relative to the Git root
`GIT_PROMPT_KIT_CWD_TRAILING_COUNT` | integer | The maximum number of trailing path components in the current working directory component. When in a Git repository, this is relative to the Git root. If less than zero, show all | `1`
`GIT_PROMPT_KIT_DEFAULT_PUSH_REMOTE_NAME` | string | The default Git push remote | `upstream`
`GIT_PROMPT_KIT_DEFAULT_REMOTE_NAME` | string | The default Git remote | `origin`
`GIT_PROMPT_KIT_HIDDEN_HOSTS` | array | The hosts that will not be included in the prompt | `()`
`GIT_PROMPT_KIT_HIDDEN_USERS` | array | The users that will not be included in the prompt | `()`
`GIT_PROMPT_KIT_LOCAL` | string | Shown if the checked-out branch has no upstream | `local`
`GIT_PROMPT_KIT_ROOT_TRAILING_COUNT` | integer | The maximum number of trailing path components in the Git root directory component * | `1`
`GIT_PROMPT_KIT_ROOT_TRAILING_COUNT` | integer | The maximum number of trailing path components in the Git root directory component. If less than zero, show all | `1`
`GIT_PROMPT_KIT_SHOW_EXTENDED_STATUS` | number | Show the stash, assume-unchanged, and skip-worktree counts (YES if non-zero, NO if zero) | `1`

### Layout options
Expand Down
4 changes: 2 additions & 2 deletions git-prompt-kit.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ _git_prompt_kit_update_git() {
GIT_PROMPT_KIT_ROOT+="%F{$GIT_PROMPT_KIT_COLOR_WORKDIR}"
root_path_components=( ${(s./.)VCS_STATUS_WORKDIR} )

if (( GIT_PROMPT_KIT_ROOT_TRAILING_COUNT + 1 >= ${#root_path_components} )); then
if (( GIT_PROMPT_KIT_ROOT_TRAILING_COUNT + 1 >= ${#root_path_components} )) || (( GIT_PROMPT_KIT_ROOT_TRAILING_COUNT < 0 )); then
GIT_PROMPT_KIT_ROOT+=${(j./.)root_path_components[0,-2]}
else
GIT_PROMPT_KIT_ROOT+=${(j./.)root_path_components[$(( -1 - GIT_PROMPT_KIT_ROOT_TRAILING_COUNT )),-2]}
Expand Down Expand Up @@ -581,7 +581,7 @@ _git_prompt_kit_update_nongit() {

GIT_PROMPT_KIT_CWD+="%F{$GIT_PROMPT_KIT_COLOR_WORKDIR}"

if (( GIT_PROMPT_KIT_CWD_TRAILING_COUNT + 1 >= ${#cwd_path_components} )); then
if (( GIT_PROMPT_KIT_CWD_TRAILING_COUNT + 1 >= ${#cwd_path_components} )) || (( GIT_PROMPT_KIT_CWD_TRAILING_COUNT < 0 )); then
GIT_PROMPT_KIT_CWD+=${(j./.)cwd_path_components[0,-1]}
else
GIT_PROMPT_KIT_CWD+=.../${(j./.)cwd_path_components[$(( -1 - GIT_PROMPT_KIT_CWD_TRAILING_COUNT )),-1]}
Expand Down

0 comments on commit 63bdab6

Please sign in to comment.