diff --git a/tools/powershell/Navigation.ps1 b/tools/powershell/Navigation.ps1 index 463d482..99a55ac 100644 --- a/tools/powershell/Navigation.ps1 +++ b/tools/powershell/Navigation.ps1 @@ -9,20 +9,3 @@ ${function:docs} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Docum ${function:down} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Downloads") } ${function:dt} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Desktop") } ${function:one} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "OneDrive") } - - -if (Get-Command zoxide -ErrorAction SilentlyContinue) { - Invoke-Expression (& { (zoxide init powershell | Out-String) }) - ${function:...} = { z -Path (Join-Path -Path .. -ChildPath ..) } - ${function:....} = { z -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) } - ${function:.....} = { z -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) } - ${function:......} = { z -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) } - ${function:z-} = { z - } -} -else { - ${function:...} = { Set-Location -Path (Join-Path -Path .. -ChildPath ..) } - ${function:....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) } - ${function:.....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) } - ${function:......} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) } - ${function:z-} = { Set-Location - } -} diff --git a/tools/powershell/Prompt.ps1 b/tools/powershell/Prompt.ps1 index 105dacd..ae31068 100644 --- a/tools/powershell/Prompt.ps1 +++ b/tools/powershell/Prompt.ps1 @@ -49,3 +49,22 @@ $Colors = @{ # Set the colours Set-PSReadLineOption -Colors $Colors + +# Smarter cd +# Init zoxide apter starship to avoid conflicts +# https://github.com/ajeetdsouza/zoxide/issues/723 +if (Get-Command zoxide -ErrorAction SilentlyContinue) { + Invoke-Expression (& { (zoxide init powershell | Out-String) }) + ${function:...} = { z -Path (Join-Path -Path .. -ChildPath ..) } + ${function:....} = { z -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) } + ${function:.....} = { z -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) } + ${function:......} = { z -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) } + ${function:z-} = { z - } +} +else { + ${function:...} = { Set-Location -Path (Join-Path -Path .. -ChildPath ..) } + ${function:....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) } + ${function:.....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) } + ${function:......} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) } + ${function:z-} = { Set-Location - } +}