romkatv / powerlevel10k

A Zsh theme
MIT License
46.59k stars 2.19k forks source link

Add example on how to change formatting of git status #1511

Closed VenkatRamaraju closed 3 years ago

VenkatRamaraju commented 3 years ago

The README currently says to edit the source code directly to change the formatting of git status. Do you think it would be good to have an example there?

For me, I did not want to see any numbers in the prompt for a git repo folder. By default, the prompt will display the count of tracked/untracked files, and other things in this list. I had to comment out a section of code in the my_git_formatter function of the ~/.p10k.zsh file to remove these numbers from the prompt.

I'd be willing to open a PR on the README (or wherever you think is best) with the example of what I did, I think it could be of some help. If you don't think it's worth it, feel free to close the issue.

romkatv commented 3 years ago

What kind of examples do you think would be useful? Deleting a bunch of lines (as I understand you’ve done in your own config) can likely be done as easily without an example.

VenkatRamaraju commented 3 years ago

It was straightforward, I just thought an explicit example would make it much clearer. Something along the lines of:

For example, if you do not want the count of various symbols in git status to show in your prompt, you can comment out this section of the source code.

    # (( VCS_STATUS_NUM_STAGED     )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}"
    # !42 if have unstaged changes.
    # (( VCS_STATUS_NUM_UNSTAGED   )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}"
    # ?42 if have untracked files. It's really a question mark, your font isn't broken.
    # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon.
    # Remove the next line if you don't want to see untracked files at all.
    # (( VCS_STATUS_NUM_UNTRACKED  )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}"
    # "─" if the number of unstaged files is unknown. This can happen due to
    # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower
    # than the number of files in the Git index, or due to bash.showDirtyState being set to false
    # in the repository config. The number of staged and untracked files may also be unknown
    # in this case.

And then perhaps the before and after pictures of the prompt.

romkatv commented 3 years ago

I'm not sure this example would be valuable enough to justify its size. Several reasons:

  1. This is the first time I'm seeing someone with the goal of removing counters from git status, so it's not something many users would want.
  2. I personally think this change is for the worse (knowing whether you have unstaged changes and untracked files is very useful), and I wouldn't want to suggest to users that they should apply it.
  3. I would hope that users can figure out just as quickly without an example how to delete lines of code if they want to delete something from prompt.
VenkatRamaraju commented 3 years ago

Fair points, I'll close the issue.

Thank you!