mirror of
https://github.com/starship/starship.git
synced 2026-06-22 02:02:12 +07:00
feat: added truncation_length/symbol to git_branch (#268)
Git branches can become very long (e.g. gitlab auto-generated branch names), thus it would be nice to be able to truncate them to keep your prompt lenght in line. This patch adds two new options to the git_branch module: * truncation_length: The amount of graphemes to of a gitbranch to truncate to * truncation_symbol: The symbol that should be used to indicate that a branch name was trunctated To be able to correctly work with UTF-8 graphemes, unicode-segmentation was added as a dependency.
This commit is contained in:
committed by
Matan Kushner
parent
f8929c2d7d
commit
59e8b1fc92
@@ -211,10 +211,12 @@ The `git_branch` module shows the active branch of the repo in your current dire
|
||||
|
||||
### Options
|
||||
|
||||
| Variable | Default | Description |
|
||||
| ---------- | ------- | ----------------------------------------------------------------------------- |
|
||||
| `symbol` | `" "` | The symbol used before the branch name of the repo in your current directory. |
|
||||
| `disabled` | `false` | Disables the `git_branch` module. |
|
||||
| Variable | Default | Description |
|
||||
| ------------------- | ---------- | ------------------------------------------------------------------------------------- |
|
||||
| `symbol` | `" "` | The symbol used before the branch name of the repo in your current directory. |
|
||||
| `disabled` | `false` | Disables the `git_branch` module. |
|
||||
| `truncation_length` | `2^63 - 1` | Truncates a git branch to X graphemes |
|
||||
| `truncation_symbol` | `"…"` | The symbol used to indicate a branch name was truncated. You can use "" for no symbol |
|
||||
|
||||
### Example
|
||||
|
||||
@@ -223,6 +225,8 @@ The `git_branch` module shows the active branch of the repo in your current dire
|
||||
|
||||
[git_branch]
|
||||
symbol = "🌱 "
|
||||
truncation_length = "4"
|
||||
truncation_symbol = ""
|
||||
```
|
||||
|
||||
## Git Status
|
||||
|
||||
Reference in New Issue
Block a user