Skip to content

Instantly share code, notes, and snippets.

@oldtune
Created June 10, 2024 09:16
Show Gist options
  • Save oldtune/b111dca4f099c85fe1841b62482e726f to your computer and use it in GitHub Desktop.
Save oldtune/b111dca4f099c85fe1841b62482e726f to your computer and use it in GitHub Desktop.
Powershell + Starship duplicate tab using CWD (Current working directory)
function Invoke-Starship-PreCommand {
$loc = $executionContext.SessionState.Path.CurrentLocation;
$prompt = "$([char]27)]9;12$([char]7)"
if ($loc.Provider.Name -eq "FileSystem")
{
$prompt += "$([char]27)]9;9;`"$($loc.ProviderPath)`"$([char]27)\"
}
$host.ui.Write($prompt)
}
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
Invoke-Expression (&starship init powershell)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment