mirror of
https://github.com/wez/wezterm.git
synced 2024-12-25 22:33:52 +03:00
Add function for users powershell + starship
References: Similar script for wt https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory#powershell-with-posh-git Custom pre-prompt in starship https://starship.rs/advanced-config/#custom-pre-prompt-and-pre-execution-commands-in-powershell
This commit is contained in:
parent
4afedd626d
commit
e3446316fd
@ -128,6 +128,21 @@ function prompt {
|
||||
}
|
||||
```
|
||||
|
||||
### OSC 7 on Windows with powershell (with starship)
|
||||
|
||||
When you're using [Starship](https://starship.rs/), the prompt is already modify, in this case can add only the necessary output to the already modified prompt, with a function like this in [powershell profile](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.1):
|
||||
|
||||
```powershell
|
||||
$prompt = ""
|
||||
function Invoke-Starship-PreCommand {
|
||||
$current_location = $executionContext.SessionState.Path.CurrentLocation
|
||||
if ($current_location.Provider.Name -eq "FileSystem") {
|
||||
$provider_path = $current_location.ProviderPath -replace "\\", "/"
|
||||
$prompt = "$ansi_escape]7;file://${env:COMPUTERNAME}/${provider_path}$ansi_escape\"
|
||||
}
|
||||
$host.ui.Write($prompt)
|
||||
````
|
||||
|
||||
## Using Clink on Windows Systems
|
||||
|
||||
[Clink](https://github.com/chrisant996/clink) brings bash style line editing,
|
||||
|
Loading…
Reference in New Issue
Block a user