mirror of
https://github.com/skywind3000/z.lua
synced 2026-03-22 07:39:48 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3482460bd2 | ||
|
|
bcb5599c12 | ||
|
|
ef8767c5f0 | ||
|
|
23aeabedd9 | ||
|
|
27dceb9899 | ||
|
|
19b2d1747e |
@@ -122,12 +122,10 @@ z -b foo bar # replace foo with bar in cwd and cd there
|
||||
|
||||
Put something like this in your `env.nu`:
|
||||
|
||||
lua /path/to/z.lua --init nushell | save -f ~/.cache/zlua.nu
|
||||
mkdir ($nu.data-dir | path join "vendor/autoload")
|
||||
lua /path/to/z.lua --init nushell | save -f ($nu.data-dir | path join "vendor/autoload/zlua.nu")
|
||||
|
||||
Then put something like this in your `config.nu`:
|
||||
|
||||
source ~/.cache/zlua.nu
|
||||
alias z = _zlua
|
||||
Note: Only Nushell v0.96+ is supported
|
||||
|
||||
- Power Shell:
|
||||
|
||||
|
||||
13
z.lua
13
z.lua
@@ -4,7 +4,7 @@
|
||||
-- z.lua - a cd command that learns, by skywind 2018-2022
|
||||
-- Licensed under MIT license.
|
||||
--
|
||||
-- Version 1.8.22, Last Modified: 2025/05/17 13:54:38
|
||||
-- Version 1.8.24, Last Modified: 2025/05/24 23:04:42
|
||||
--
|
||||
-- * 10x faster than fasd and autojump, 3x faster than z.sh
|
||||
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
|
||||
@@ -1979,7 +1979,7 @@ function main(argv)
|
||||
path = z_cd(args)
|
||||
if path == nil and Z_MATCHMODE ~= 0 then
|
||||
local last = args[#args]
|
||||
if os.path.isdir(last) then
|
||||
if last and os.path.isdir(last) then
|
||||
path = os.path.abspath(last)
|
||||
path = os.path.norm(path)
|
||||
end
|
||||
@@ -2655,9 +2655,7 @@ if /i "%1"=="--purge" (
|
||||
)
|
||||
:check
|
||||
if /i "%1"=="" (
|
||||
if /i "%InterMode%"=="" (
|
||||
set "RunMode=-l"
|
||||
)
|
||||
set "RunMode=-l"
|
||||
)
|
||||
for /f "delims=" %%i in ('cd') do set "PWD=%%i"
|
||||
if /i "%RunMode%"=="-n" (
|
||||
@@ -2814,7 +2812,7 @@ end
|
||||
-- nushell
|
||||
-----------------------------------------------------------------------
|
||||
local script_zlua_nushell = [[
|
||||
def _zlua --env --wrapped [...args: string] {
|
||||
export def _zlua --env --wrapped [...args: string] {
|
||||
if ($args | length) != 0 and $args.0 == "--add" {
|
||||
with-env { _ZL_RANDOM: (random int) } { ^$env.ZLUA_LUAEXE $env.ZLUA_SCRIPT --add ...($args | skip 1) }
|
||||
} else if ($args | length) != 0 and $args.0 == "--complete" {
|
||||
@@ -2899,6 +2897,9 @@ if completer in $env.config.completions.external {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export alias z = _zlua
|
||||
|
||||
]]
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user