perf(git_status): add option to use windows starship to render in wsl (#2146)

This commit is contained in:
David Knaack
2022-03-07 04:18:23 +01:00
committed by GitHub
parent 6f1d19470e
commit d2366ddb9c
4 changed files with 161 additions and 29 deletions
+34 -17
View File
@@ -1480,25 +1480,33 @@ format = '[+$added]($added_style)/[-$deleted]($deleted_style) '
The `git_status` module shows symbols representing the state of the repo in your
current directory.
::: tip
The Git Status module is very slow in Windows directories (for example under `/mnt/c/`) when in a WSL environment.
You can disable the module or use the `windows_starship` option to use a Windows-native Starship executable to compute `git_status` for those paths.
:::
### Options
| Option | Default | Description |
| ------------------- | --------------------------------------------- | ----------------------------------- |
| `format` | `'([\[$all_status$ahead_behind\]]($style) )'` | The default format for `git_status` |
| `conflicted` | `"="` | This branch has merge conflicts. |
| `ahead` | `"⇡"` | The format of `ahead` |
| `behind` | `"⇣"` | The format of `behind` |
| `diverged` | `"⇕"` | The format of `diverged` |
| `up_to_date` | `""` | The format of `up_to_date` |
| `untracked` | `"?"` | The format of `untracked` |
| `stashed` | `"$"` | The format of `stashed` |
| `modified` | `"!"` | The format of `modified` |
| `staged` | `"+"` | The format of `staged` |
| `renamed` | `"»"` | The format of `renamed` |
| `deleted` | `"✘"` | The format of `deleted` |
| `style` | `"bold red"` | The style for the module. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
| Option | Default | Description |
| ------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `format` | `'([\[$all_status$ahead_behind\]]($style) )'` | The default format for `git_status` |
| `conflicted` | `"="` | This branch has merge conflicts. |
| `ahead` | `"⇡"` | The format of `ahead` |
| `behind` | `"⇣"` | The format of `behind` |
| `diverged` | `"⇕"` | The format of `diverged` |
| `up_to_date` | `""` | The format of `up_to_date` |
| `untracked` | `"?"` | The format of `untracked` |
| `stashed` | `"$"` | The format of `stashed` |
| `modified` | `"!"` | The format of `modified` |
| `staged` | `"+"` | The format of `staged` |
| `renamed` | `"»"` | The format of `renamed` |
| `deleted` | `"✘"` | The format of `deleted` |
| `style` | `"bold red"` | The style for the module. |
| `ignore_submodules` | `false` | Ignore changes to submodules. |
| `disabled` | `false` | Disables the `git_status` module. |
| `windows_starship` | | Use this (Linux) path to a Windows Starship executable to render `git_status` when on Windows paths in WSL. |
### Variables
@@ -1562,6 +1570,15 @@ diverged = "⇕⇡${ahead_count}⇣${behind_count}"
behind = "⇣${count}"
```
Use Windows Starship executable on Windows paths in WSL
```toml
# ~/.config/starship.toml
[git_status]
windows_starship = '/mnt/c/Users/username/scoop/apps/starship/current/starship.exe'
```
## Go
The `golang` module shows the currently installed version of [Go](https://golang.org/).