Skip to content

Commit 914158c

Browse files
committed
feat(repo root): relative to home
1 parent 1a4e836 commit 914158c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

git-prompt-kit.zsh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ _git_prompt_kit_update_git() {
274274
(( show_push_behind = ! GIT_PROMPT_KIT_HIDE_INACTIVE_AHEAD_BEHIND || VCS_STATUS_PUSH_COMMITS_BEHIND ))
275275

276276
# Git repo directory
277-
repo_root_path_components=( ${(s./.)VCS_STATUS_WORKDIR} )
277+
if [[ ${VCS_STATUS_WORKDIR#$HOME} != $VCS_STATUS_WORKDIR ]]; then
278+
repo_root_path_components=( "~" ${(s./.)${VCS_STATUS_WORKDIR#$HOME}} )
279+
else
280+
repo_root_path_components=( ${(s./.)VCS_STATUS_WORKDIR} )
281+
fi
278282

279283
# path segments above the repo root dir
280284
if (( GIT_PROMPT_KIT_CWD_MAX_TRAILING_COUNT + 1 >= ${#repo_root_path_components} )) || (( GIT_PROMPT_KIT_CWD_MAX_TRAILING_COUNT < 0 )); then

0 commit comments

Comments
 (0)