feat(vcs): Introduce the VCS module (#6388)

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
This commit is contained in:
Poliorcetics
2026-01-04 17:44:03 +01:00
committed by GitHub
parent 8a69666084
commit 0dd5a4f402
11 changed files with 426 additions and 34 deletions
+41
View File
@@ -4909,6 +4909,47 @@ By default the module will be shown if any of the following conditions are met:
format = 'via [V $version](blue bold) '
```
## VCS
> Note the module is enabled by default but **not** included in the default list because that would be a breaking change.
> Additionally, the exact format of the module may change in the future, for example to handle right-aligned prompt.
The `vcs` module displays the current active Version Control System (VCS).
The module will be shown only if a configured VCS is currently in use.
### Options
| Option | Default | Description |
| ---------------- | ----------------------------------------------------------- | ----------------------------------------------------- |
| `order` | `["git", "hg", "pijul", "fossil"]` | The order in which to search VCSes. |
| `fossil_modules` | `"$fossil_branch$fossil_metrics"` | Modules to show when a Fossil repository is found. |
| `git_modules` | `"$git_branch$git_commit$git_state$git_metrics$git_status"` | Modules to show when a Git repository is found. |
| `hg_modules` | `"$hg_branch$hg_state"` | Modules to show when a Mercurial repository is found. |
| `pijul_modules` | `"$pijul_channel"` | Modules to show when a Pijul repository is found. |
| `disabled` | `false` | Disables the `vcs` module. |
### Example
```toml
# ~/.config/starship.toml
[vcs]
# Will look for Git then Pijul if not found but not for other VCSes at all
order = [
"git",
"pijul",
]
# Any module (except `$vcs` itself to avoid infinite loops) can be included here
git_modules = "$git_branch${custom.foo}"
# See documentation for custom modules
[custom.foo]
command = 'echo foo'
detect_files = ['foo']
when = ''' test "$HOME" = "$PWD" '''
format = ' transcending [$output]($style)'
```
## VCSH
The `vcsh` module displays the current active [VCSH](https://github.com/RichiH/vcsh) repository.