From 39380cdb33d81a79f165b852f7607777eefd6574 Mon Sep 17 00:00:00 2001 From: rajiknows Date: Mon, 7 Oct 2024 16:47:14 +0530 Subject: [PATCH] fixed the issue for powershell env variable --- templates/powershell.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/powershell.txt b/templates/powershell.txt index 86b1966..9d42dd5 100644 --- a/templates/powershell.txt +++ b/templates/powershell.txt @@ -27,6 +27,12 @@ function global:__zoxide_pwd { # cd + custom logic based on the value of _ZO_ECHO. function global:__zoxide_cd($dir, $literal) { + + if ($dir.StartsWith('%') -and $dir.EndsWith('%')) { + $envVar = $dir.Trim('%') + $dir = $env:$envVar + } + $dir = if ($literal) { Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop } else {