feat(remote): shorten "origin" as a pushpin

If the VCS remote name is "origin", then it will be shorten to DOTMATRIX_VCS_REMOTE_ORIGIN
This commit is contained in:
Johann Dreo 2023-11-23 23:46:57 +01:00
commit 74086c9fdd
2 changed files with 8 additions and 0 deletions

View file

@ -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. 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* **DOTMATRIX_DETACHED_THRESHOLD** *integer = 3*

View file

@ -27,6 +27,8 @@ _lp_dotmatrix_theme_activate() {
DOTMATRIX_SHELL_ZSH=${DOTMATRIX_SHELL_ZSH:-"z"} DOTMATRIX_SHELL_ZSH=${DOTMATRIX_SHELL_ZSH:-"z"}
DOTMATRIX_SHELL_BASH=${DOTMATRIX_SHELL_BASH:-"b"} DOTMATRIX_SHELL_BASH=${DOTMATRIX_SHELL_BASH:-"b"}
DOTMATRIX_VCS_REMOTE_ORIGIN=${DOTMATRIX_VCS_REMOTE_ORIGIN:-"🖈"}
DOTMATRIX_ENABLE_HISTORY=${DOTMATRIX_ENABLE_HISTORY:-0} DOTMATRIX_ENABLE_HISTORY=${DOTMATRIX_ENABLE_HISTORY:-0}
DOTMATRIX_HISTORY_LAST_LEN=${DOTMATRIX_HISTORY_LAST_LEN:-$((COLUMNS/4))} DOTMATRIX_HISTORY_LAST_LEN=${DOTMATRIX_HISTORY_LAST_LEN:-$((COLUMNS/4))}
DOTMATRIX_HISTORY_LAST_LEN_MARK=${DOTMATRIX_HISTORY_LAST_LEN_MARK:-"[…]"} DOTMATRIX_HISTORY_LAST_LEN_MARK=${DOTMATRIX_HISTORY_LAST_LEN_MARK:-"[…]"}
@ -880,6 +882,9 @@ __dotmatrix_prompt_vcs() {
# Mark & commits off remote # Mark & commits off remote
if _lp_vcs_commits_off_remote; then # There is remote-space-[local]. if _lp_vcs_commits_off_remote; then # There is remote-space-[local].
_lp_vcs_remote # Get remote name. _lp_vcs_remote # Get remote name.
if [[ "$lp_vcs_remote" == "origin" ]]; then
lp_vcs_remote="$DOTMATRIX_VCS_REMOTE_ORIGIN"
fi
# Remote segment. # Remote segment.
if [[ "$lp_vcs_commit_behind" -ne "0" ]]; then # NOTE remote segment. if [[ "$lp_vcs_commit_behind" -ne "0" ]]; then # NOTE remote segment.