From 74086c9fdd35edac376d5e03585ff80994cd237c Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 23 Nov 2023 23:46:57 +0100 Subject: [PATCH] feat(remote): shorten "origin" as a pushpin If the VCS remote name is "origin", then it will be shorten to DOTMATRIX_VCS_REMOTE_ORIGIN --- README.md | 3 +++ dotmatrix.theme | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index a294b18..c03c422 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,9 @@ Number of unpulled remote commits above which the prompt should use the warning Number of modified lines above which the prompt should use the warning color to display the "commit" section. +**DOTMATRIX_VCS_REMOTE_ORIGIN** *string* = "🖈" + +String used as a shorten VCS remote name, if it is "origin". **DOTMATRIX_DETACHED_THRESHOLD** *integer = 3* diff --git a/dotmatrix.theme b/dotmatrix.theme index fb53e60..6f40f0a 100644 --- a/dotmatrix.theme +++ b/dotmatrix.theme @@ -27,6 +27,8 @@ _lp_dotmatrix_theme_activate() { DOTMATRIX_SHELL_ZSH=${DOTMATRIX_SHELL_ZSH:-"z"} DOTMATRIX_SHELL_BASH=${DOTMATRIX_SHELL_BASH:-"b"} + DOTMATRIX_VCS_REMOTE_ORIGIN=${DOTMATRIX_VCS_REMOTE_ORIGIN:-"🖈"} + DOTMATRIX_ENABLE_HISTORY=${DOTMATRIX_ENABLE_HISTORY:-0} DOTMATRIX_HISTORY_LAST_LEN=${DOTMATRIX_HISTORY_LAST_LEN:-$((COLUMNS/4))} DOTMATRIX_HISTORY_LAST_LEN_MARK=${DOTMATRIX_HISTORY_LAST_LEN_MARK:-"[…]"} @@ -880,6 +882,9 @@ __dotmatrix_prompt_vcs() { # Mark & commits off remote if _lp_vcs_commits_off_remote; then # There is remote-space-[local]. _lp_vcs_remote # Get remote name. + if [[ "$lp_vcs_remote" == "origin" ]]; then + lp_vcs_remote="$DOTMATRIX_VCS_REMOTE_ORIGIN" + fi # Remote segment. if [[ "$lp_vcs_commit_behind" -ne "0" ]]; then # NOTE remote segment.