Skip to content

Commit 3c88f8d

Browse files
author
skywind3000
committed
recognize %_ZL_CD% in cmd.exe
1 parent 7862250 commit 3c88f8d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

z.cmd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,12 @@ rem -- Exploits variable expansion and the pushd stack to set the current
120120
rem -- directory without leaking a pushd.
121121
popd
122122
setlocal
123-
set NewPath=%CD%
124-
endlocal & popd & cd /d "%NewPath%"
123+
set "NewPath=%CD%"
124+
set "CDCmd=cd /d"
125+
if /i not "%_ZL_CD%"=="" (
126+
set "CDCmd=%_ZL_CD%"
127+
)
128+
endlocal & popd & %CDCmd% "%NewPath%"
125129

126130
:end
127131
echo.

z.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#! /usr/bin/env lua
22
--=====================================================================
33
--
4-
-- z.lua - a cd command that learns, by skywind 2018, 2019, 2020, 2021
4+
-- z.lua - a cd command that learns, by skywind 2018-2022
55
-- Licensed under MIT license.
66
--
7-
-- Version 1.8.12, Last Modified: 2021/02/15 00:05
7+
-- Version 1.8.13, Last Modified: 2022/01/30 10:46
88
--
99
-- * 10x faster than fasd and autojump, 3x faster than z.sh
1010
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -2563,7 +2563,11 @@ goto end
25632563
popd
25642564
setlocal
25652565
set "NewPath=%CD%"
2566-
endlocal & popd & cd /d "%NewPath%"
2566+
set "CDCmd=cd /d"
2567+
if /i not "%_ZL_CD%"=="" (
2568+
set "CDCmd=%_ZL_CD%"
2569+
)
2570+
endlocal & popd & %CDCmd% "%NewPath%"
25672571
:end
25682572
]]
25692573

0 commit comments

Comments
 (0)