Skip to content

Commit

Permalink
recognize %_ZL_CD% in cmd.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
skywind3000 committed Jan 30, 2022
1 parent 7862250 commit 3c88f8d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions z.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ rem -- Exploits variable expansion and the pushd stack to set the current
rem -- directory without leaking a pushd.
popd
setlocal
set NewPath=%CD%
endlocal & popd & cd /d "%NewPath%"
set "NewPath=%CD%"
set "CDCmd=cd /d"
if /i not "%_ZL_CD%"=="" (
set "CDCmd=%_ZL_CD%"
)
endlocal & popd & %CDCmd% "%NewPath%"

:end
echo.
Expand Down
10 changes: 7 additions & 3 deletions z.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#! /usr/bin/env lua
--=====================================================================
--
-- z.lua - a cd command that learns, by skywind 2018, 2019, 2020, 2021
-- z.lua - a cd command that learns, by skywind 2018-2022
-- Licensed under MIT license.
--
-- Version 1.8.12, Last Modified: 2021/02/15 00:05
-- Version 1.8.13, Last Modified: 2022/01/30 10:46
--
-- * 10x faster than fasd and autojump, 3x faster than z.sh
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
Expand Down Expand Up @@ -2563,7 +2563,11 @@ goto end
popd
setlocal
set "NewPath=%CD%"
endlocal & popd & cd /d "%NewPath%"
set "CDCmd=cd /d"
if /i not "%_ZL_CD%"=="" (
set "CDCmd=%_ZL_CD%"
)
endlocal & popd & %CDCmd% "%NewPath%"
:end
]]

Expand Down

0 comments on commit 3c88f8d

Please sign in to comment.