1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-23 16:19:49 +00:00

3 Commits

Author SHA1 Message Date
skywind3000
3482460bd2 update version number 2025-05-24 23:05:00 +08:00
Linwei
bcb5599c12 Merge pull request #221 from brglng/feature/nushell
feat(nushell)!: improve nushell support for nushell v0.96+
2025-05-21 23:37:24 +08:00
Zhaosheng Pan
ef8767c5f0 feat(nushell)!: improve nushell support for nushell v0.96+ 2025-05-21 22:45:12 +08:00
2 changed files with 9 additions and 10 deletions

View File

@@ -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:

11
z.lua
View File

@@ -4,7 +4,7 @@
-- z.lua - a cd command that learns, by skywind 2018-2022
-- Licensed under MIT license.
--
-- Version 1.8.23, Last Modified: 2025/05/18 00:18:20
-- 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
@@ -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
]]
-----------------------------------------------------------------------