Skip to content

Add ability to hide specific flags by setting their symbols to empty string #132

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

Merged
merged 2 commits into from
Jul 31, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 31, 2025

This PR implements the ability to hide individual flags without disabling all flags, addressing the feature request for selective flag visibility.

Problem

Previously, flag display was all-or-nothing - users could only hide all flags or show all flags. There was no way to hide specific flag types (like stashes) while keeping others visible.

Solution

Following @arl's suggestion, flags are now completely hidden (including their counts) when their corresponding symbol is set to an empty string ("").

Examples

Before - stash count always visible when present:

symbols:
  stashed: ""  # Shows: ⚑ 3

After - stash count hidden by setting empty symbol:

symbols:
  stashed: ""    # Shows: (nothing)

This works for all flag types:

  • staged: staged files count
  • conflict: conflict files count
  • modified: modified files count
  • untracked: untracked files count
  • stashed: stash entries count
  • clean: clean status symbol

Implementation

  • Modified the flags() method in tmux/formater.go to check for empty symbols before formatting flags
  • Added comprehensive test coverage for all flag types with empty symbols
  • Maintains backward compatibility - existing configurations continue to work unchanged

Fixes #115.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@arl
Copy link
Owner

arl commented Jul 31, 2025

@copilot Simply make it so that if the symbol for a flag is empty, then we won't display it nor the count.

@Copilot Copilot AI changed the title [WIP] [FEATURE] Ability to hide some flags Add ability to hide specific flags by setting their symbols to empty string Jul 31, 2025
@Copilot Copilot AI requested a review from arl July 31, 2025 10:05
Copilot finished work on behalf of arl July 31, 2025 10:05
Copy link
Contributor Author

Copilot AI commented Jul 31, 2025

@copilot Simply make it so that if the symbol for a flag is empty, then we won't display it nor the count.

Done! I've implemented exactly what you requested. The flags() method now checks if each symbol is empty, and when it is, that flag (including its count) won't be displayed.

All flag types are supported:

  • staged, conflict, modified, untracked, stashed, clean

When any symbol is set to "", that specific flag is completely hidden while other flags continue to work normally.

Implementation is in commit a0c54a0 with comprehensive test coverage.

Copilot finished work on behalf of arl July 31, 2025 10:12
Copy link
Owner

@arl arl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@arl arl marked this pull request as ready for review July 31, 2025 10:14
@arl arl merged commit 70a3133 into main Jul 31, 2025
7 checks passed
@arl arl deleted the copilot/fix-115 branch July 31, 2025 10:15
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

Successfully merging this pull request may close these issues.

[FEATURE] Ability to hide some flags
2 participants