Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Indicate whether the git branch is tracked #2361

Closed
bazzilic opened this issue Jun 25, 2023 · 6 comments
Closed

[Feature] Indicate whether the git branch is tracked #2361

bazzilic opened this issue Jun 25, 2023 · 6 comments

Comments

@bazzilic
Copy link

This is a request to add an indicator of whether the git branch is tracked or not. It's often a very useful piece of information to have at a glance.

In Oh-My-Posh plugin for PowerShell, the git prompt indicated whether the branch is tracked next to the branch name. So, for an untracked branch, it would just show the branch name, and for a tracked branch that is up to date with the remote, it would show the symbol. For tracked branches that are ahead/behind it would do the same as Powerlevel does currently with the up/down arrow symbols.

image

@romkatv
Copy link
Owner

romkatv commented Jun 26, 2023

I've implemented this. If you update powerlevel10k, run p10k configure and select any style except Pure, you'll see = in git status when your local branch is up to date with the remote.

If many people complain or get confused by the new icon, I'll revert the change.

Note that you can achieve this by editing my_git_formatter within your ~/.p10k.zsh. Something like this:

-  (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}"
-  (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" "
-  (( VCS_STATUS_COMMITS_AHEAD  )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}"
+  if (( VCS_STATUS_COMMITS_AHEAD || VCS_STATUS_COMMITS_BEHIND )); then
+    (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}"
+    (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" "
+    (( VCS_STATUS_COMMITS_AHEAD  )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}"
+  elif [[ -n $VCS_STATUS_REMOTE_BRANCH ]]; then
+    res+=" ${clean}≡"
+  fi

You don't need to update powerlevel10k or run p10k configure if you opt for the manual edit approach.

@romkatv romkatv closed this as completed Jun 28, 2023
@sleepymole
Copy link

image

The new icon takes up more prompt space. I would prefer the old version.

@romkatv
Copy link
Owner

romkatv commented Jul 11, 2023

@gozssky See #2377 (comment).

romkatv added a commit that referenced this issue Jul 12, 2023
…mote

#2361 requested an indicator for
up to date branches, which was added in
20323d6.

Since then, 3 users complained about the new indicator:

- #2377
- #2380
- #2361 (comment)

On one hand we have one request to add a feature. On the other hand we have
three complaints about the feature's existence. The feature is going away.
@romkatv
Copy link
Owner

romkatv commented Jul 12, 2023

If many people complain or get confused by the new icon, I'll revert the change.

I've received 3 complaints and reverted the change.

Note that the original commit and the revert commit only affect the content of configs generated by the configuration wizard. Neither of these commits affects the behavior of powerlevel10k with a fixed config. Thus, if you want to see/hide = for up to date branches, run p10k configure. If that doesn't produce the desired results, manually edit my_git_formatter in ~/.p10k.zsh.

@bazzilic
Copy link
Author

Can this be configurable (enable/disable) in the p10k configure?

@romkatv
Copy link
Owner

romkatv commented Jul 12, 2023

Only important options make their way into the configuration wizard. An option that hardly makes a difference isn't worth everyone's time when they are running the wizard. It is perfectly suitable for customization through editing ~/.p10k.zsh though.

YingchangLiu pushed a commit to YingchangLiu/dotfiles that referenced this issue Aug 10, 2024
…mote

romkatv/powerlevel10k#2361 requested an indicator for
up to date branches, which was added in
20323d6.

Since then, 3 users complained about the new indicator:

- romkatv/powerlevel10k#2377
- romkatv/powerlevel10k#2380
- romkatv/powerlevel10k#2361 (comment)

On one hand we have one request to add a feature. On the other hand we have
three complaints about the feature's existence. The feature is going away.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants