mirror of
https://github.com/skywind3000/z.lua
synced 2026-03-24 16:49:47 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3482460bd2 | ||
|
|
bcb5599c12 | ||
|
|
ef8767c5f0 |
@@ -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`:
|
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`:
|
Note: Only Nushell v0.96+ is supported
|
||||||
|
|
||||||
source ~/.cache/zlua.nu
|
|
||||||
alias z = _zlua
|
|
||||||
|
|
||||||
- Power Shell:
|
- Power Shell:
|
||||||
|
|
||||||
|
|||||||
11
z.lua
11
z.lua
@@ -4,7 +4,7 @@
|
|||||||
-- z.lua - a cd command that learns, by skywind 2018-2022
|
-- z.lua - a cd command that learns, by skywind 2018-2022
|
||||||
-- Licensed under MIT license.
|
-- 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
|
-- * 10x faster than fasd and autojump, 3x faster than z.sh
|
||||||
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
|
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
|
||||||
@@ -2655,9 +2655,7 @@ if /i "%1"=="--purge" (
|
|||||||
)
|
)
|
||||||
:check
|
:check
|
||||||
if /i "%1"=="" (
|
if /i "%1"=="" (
|
||||||
if /i "%InterMode%"=="" (
|
set "RunMode=-l"
|
||||||
set "RunMode=-l"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
for /f "delims=" %%i in ('cd') do set "PWD=%%i"
|
for /f "delims=" %%i in ('cd') do set "PWD=%%i"
|
||||||
if /i "%RunMode%"=="-n" (
|
if /i "%RunMode%"=="-n" (
|
||||||
@@ -2814,7 +2812,7 @@ end
|
|||||||
-- nushell
|
-- nushell
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
local script_zlua_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" {
|
if ($args | length) != 0 and $args.0 == "--add" {
|
||||||
with-env { _ZL_RANDOM: (random int) } { ^$env.ZLUA_LUAEXE $env.ZLUA_SCRIPT --add ...($args | skip 1) }
|
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" {
|
} 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