mirror of
https://github.com/arl/gitmux.git
synced 2026-09-10 07:26:18 -04:00
feat: option to add space between behind & ahead upstream
Signed-off-by: marcoSven <me@marcosven.com>
This commit is contained in:
parent
b821624bad
commit
2f3dbaba49
|
|
@ -83,3 +83,4 @@ tmux:
|
|||
hide_clean: false
|
||||
# Swaps order of behind & ahead upstream counts - "↓·1↑·1" -> "↑·1↓·1"
|
||||
swap_divergence: false
|
||||
space_between_divergence: false
|
||||
|
|
|
|||
16
README.md
16
README.md
|
|
@ -133,6 +133,7 @@ tmux:
|
|||
ellipsis: …
|
||||
hide_clean: false
|
||||
swap_divergence: false
|
||||
space_between_divergence: false
|
||||
```
|
||||
|
||||
First, save the default configuration to a new file:
|
||||
|
|
@ -264,13 +265,14 @@ layout: [branch, "|", flags, "|", stats]
|
|||
|
||||
This is the list of additional configuration `options`:
|
||||
|
||||
| Option | Description | Default |
|
||||
| :--------------- | :--------------------------------------------------------- | :----------------: |
|
||||
| `branch_max_len` | Maximum displayed length for local and remote branch names | `0` (no limit) |
|
||||
| `branch_trim` | Trim left or right end of the branch (`right` or `left`) | `right` (trailing) |
|
||||
| `ellipsis` | Character to show branch name has been truncated | `…` |
|
||||
| `hide_clean` | Hides the clean flag entirely | `false` |
|
||||
| `swap_divergence`| Swaps order of behind & ahead upstream counts | `false` |
|
||||
| Option | Description | Default |
|
||||
| :------------------------ | :--------------------------------------------------------- | :----------------: |
|
||||
| `branch_max_len` | Maximum displayed length for local and remote branch names | `0` (no limit) |
|
||||
| `branch_trim` | Trim left or right end of the branch (`right` or `left`) | `right` (trailing) |
|
||||
| `ellipsis` | Character to show branch name has been truncated | `…` |
|
||||
| `hide_clean` | Hides the clean flag entirely | `false` |
|
||||
| `swap_divergence` | Swaps order of behind & ahead upstream counts | `false` |
|
||||
| `space_between_divergence`| Add space between behind & ahead upstream counts | `false` |
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
|
|
|||
|
|
@ -85,11 +85,12 @@ func (d *direction) UnmarshalYAML(value *yaml.Node) error {
|
|||
}
|
||||
|
||||
type options struct {
|
||||
BranchMaxLen int `yaml:"branch_max_len"`
|
||||
BranchTrim direction `yaml:"branch_trim"`
|
||||
Ellipsis string `yaml:"ellipsis"`
|
||||
HideClean bool `yaml:"hide_clean"`
|
||||
SwapDivergence bool `yaml:"swap_divergence"`
|
||||
BranchMaxLen int `yaml:"branch_max_len"`
|
||||
BranchTrim direction `yaml:"branch_trim"`
|
||||
Ellipsis string `yaml:"ellipsis"`
|
||||
HideClean bool `yaml:"hide_clean"`
|
||||
SpaceBetweenDivergence bool `yaml:"space_between_divergence"`
|
||||
SwapDivergence bool `yaml:"swap_divergence"`
|
||||
}
|
||||
|
||||
// A Formater formats git status to a tmux style string.
|
||||
|
|
@ -245,13 +246,18 @@ func (f *Formater) divergence() string {
|
|||
|
||||
behind := ""
|
||||
ahead := ""
|
||||
space := ""
|
||||
|
||||
s := f.Styles.Clear + f.Styles.Divergence
|
||||
if f.st.BehindCount != 0 {
|
||||
if f.Options.SpaceBetweenDivergence {
|
||||
space = " "
|
||||
}
|
||||
behind = fmt.Sprintf("%s%d", f.Symbols.Behind, f.st.BehindCount)
|
||||
}
|
||||
|
||||
if f.st.AheadCount != 0 {
|
||||
ahead = fmt.Sprintf("%s%d", f.Symbols.Ahead, f.st.AheadCount)
|
||||
ahead = fmt.Sprintf("%s%s%d", space, f.Symbols.Ahead, f.st.AheadCount)
|
||||
}
|
||||
|
||||
if !f.Options.SwapDivergence {
|
||||
|
|
|
|||
Loading…
Reference in a new issue