-
Notifications
You must be signed in to change notification settings - Fork 213
Closed
Description
I am using oh-my-posh and would like to add a working CWD configuration to restore directories. I basically use a modified version of the posh-git configuration.
At the top of my PowerShell profile I add the following:
# Load Posh theme
Set-PoshPrompt -Theme robbyrussel
# Store prompt for later
[ScriptBlock]$Prompt = $function:prompt
# Create Prompt function sending CWD to terminal
function prompt {
$loc = Get-Location
$prompt = & $Prompt
$prompt += "$([char]27)]9;12$([char]7)"
if ($loc.Provider.Name -eq "FileSystem") {
$prompt += "$([char]27)]9;9;`"$($loc.Path)`"$([char]7)"
}
return $prompt
}
Hope this helps 😊
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 439baddf-3ec9-a46e-1b6e-3ec47cbd1d4c
- Version Independent ID: 439baddf-3ec9-a46e-1b6e-3ec47cbd1d4c
- Content: Opening a tab/pane in the same directory
- Content Source: TerminalDocs/tutorials/new-tab-same-directory.md
- Product: dev-environment
- Technology: windows-terminal
- GitHub Login: @zadjii-msft
- Microsoft Alias: migrie
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels