You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The readme suggests hooking every prompt to the update-navigationhistory function with the below piece of code.
This overrides any other hook that was already added (eg Oh-My-Posh) and on my mashine only appeared to work in elevated mode. Depending on the order of execution one hook overrides the next.
After some digging I landed on a wrapping Set-Location instead.
This appears to be conflict free and more focused on the relevant command instead of every command.
Still feels a little dirty so open for feedback.
Before:
function Prompt {
Update-NavigationHistory $pwd.Path
}
After:
# Save the existing Set-Location cmdlet to a variable
# Then redefine Set-Location to include Update-NavigationHistory
$originalSetLocation = Get-Command Set-Location
function Set-Location {
param (
[string]$Path,
[switch]$PassThru,
[switch]$UseTransaction,
[pscredential]$Credential
)
& $originalSetLocation @PSBoundParameters
Update-NavigationHistory (Get-Location).Path
}
The text was updated successfully, but these errors were encountered:
The readme suggests hooking every prompt to the update-navigationhistory function with the below piece of code.
This overrides any other hook that was already added (eg Oh-My-Posh) and on my mashine only appeared to work in elevated mode. Depending on the order of execution one hook overrides the next.
After some digging I landed on a wrapping Set-Location instead.
This appears to be conflict free and more focused on the relevant command instead of every command.
Still feels a little dirty so open for feedback.
Before:
After:
The text was updated successfully, but these errors were encountered: