mirror of
https://github.com/skywind3000/z.lua
synced 2026-03-22 07:39:48 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6025da3ae5 | ||
|
|
1ebe5bcaa7 | ||
|
|
e1eb7a2104 | ||
|
|
f80e22498c | ||
|
|
ce1ee31529 | ||
|
|
aebea97d8e | ||
|
|
314dd0a29d |
@@ -14,7 +14,7 @@ z.lua 是一个快速路径切换工具,它会跟踪你在 shell 下访问过
|
||||
|
||||
- 性能比 **z.sh** 快三倍,比 **fasd** / **autojump** 快十倍以上。
|
||||
- 支持 Posix Shell:bash, zsh, dash, sh, ash, busybox 等等。
|
||||
- 支持 Fish Shell,Power Shell 和 Windows cmd。
|
||||
- 支持 Fish Shell,Nushell, Power Shell 和 Windows cmd。
|
||||
- 使用增强匹配算法,更准确的带你去到你想去的地方。
|
||||
- 低占用,能够仅在当前路径改变时才更新数据库(将 `$_ZL_ADD_ONCE` 设成 1)。
|
||||
- 交互选择模式,如果有多个匹配结果的话,跳转前允许你进行选择。
|
||||
@@ -93,7 +93,6 @@ z -b foo # 跳转到父目录中名称以 foo 开头的那一级
|
||||
然后在 `config.nu` 中加入如下代码:
|
||||
|
||||
source ~/.cache/zlua.nu
|
||||
alias z = _zlua
|
||||
|
||||
- Power Shell:
|
||||
|
||||
|
||||
27
README.md
27
README.md
@@ -28,7 +28,7 @@ From people using z.lua:
|
||||
- **10x** times faster than **fasd** and **autojump**, **3x** times faster than **z.sh**.
|
||||
- Gain the ultimate speed with an optional [native module](https://github.com/skywind3000/czmod) written in C.
|
||||
- Available for **posix shells**: bash, zsh, dash, sh, ash, ksh, busybox and etc.
|
||||
- Available for Fish Shell, Power Shell and Windows cmd.
|
||||
- Available for Fish Shell, Nushell, Power Shell and Windows cmd.
|
||||
- [Enhanced matching algorithm](#enhanced-matching) takes you to where ever you want precisely.
|
||||
- Allow updating database only if `$PWD` changed with "$_ZL_ADD_ONCE" set to 1.
|
||||
- Interactive selection enables you to choose where to go before cd.
|
||||
@@ -78,6 +78,12 @@ z -b foo bar # replace foo with bar in cwd and cd there
|
||||
|
||||
eval "$(lua /path/to/z.lua --init bash enhanced once fzf)"
|
||||
|
||||
NixOS users using home-manager can add this to their user profile:
|
||||
|
||||
programs.z-lua.enable = true;
|
||||
programs.z-lua.enableBashIntegration = true;
|
||||
programs.z-lua.options = [ "enhanced" "once" "fzf" ]; # modify as needed
|
||||
|
||||
**NOTE**: For wsl-1 users, `lua-filesystem` must be installed:
|
||||
|
||||
sudo apt-get install lua-filesystem
|
||||
@@ -92,6 +98,12 @@ z -b foo bar # replace foo with bar in cwd and cd there
|
||||
|
||||
Options like "enhanced", "once" and "fzf" can be used after `--init` too. It can also be initialized from "skywind3000/z.lua" with your zsh plugin managers (antigen / oh-my-zsh).
|
||||
|
||||
NixOS users using home-manager can add this to their user profile:
|
||||
|
||||
programs.z-lua.enable = true;
|
||||
programs.z-lua.enableZshIntegration = true;
|
||||
programs.z-lua.options = [ "enhanced" "once" "fzf" ]; # modify as needed
|
||||
|
||||
**NOTE**: for wsl-1 users, `lua-filesystem` must be installed.
|
||||
|
||||
- Posix Shells:
|
||||
@@ -118,12 +130,21 @@ z -b foo bar # replace foo with bar in cwd and cd there
|
||||
|
||||
into the same file.
|
||||
|
||||
NixOS users using home-manager can add this to their user profile:
|
||||
|
||||
programs.z-lua.enable = true;
|
||||
programs.z-lua.enableFishIntegration = true;
|
||||
programs.z-lua.options = [ "enhanced" "once" "fzf" ]; # modify as needed
|
||||
|
||||
- Nushell
|
||||
|
||||
Put something like this in your `env.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")
|
||||
lua /path/to/z.lua --init nushell | save -f ~/.cache/zlua.nu
|
||||
|
||||
Then put something like this in your `config.nu`:
|
||||
|
||||
source ~/.cache/zlua.nu
|
||||
|
||||
Note: Only Nushell v0.96+ is supported
|
||||
|
||||
|
||||
5
z.lua
5
z.lua
@@ -4,7 +4,7 @@
|
||||
-- z.lua - a cd command that learns, by skywind 2018-2022
|
||||
-- Licensed under MIT license.
|
||||
--
|
||||
-- Version 1.8.24, Last Modified: 2025/05/24 23:04:42
|
||||
-- Version 1.8.25, Last Modified: 2026/03/09 21:15:46
|
||||
--
|
||||
-- * 10x faster than fasd and autojump, 3x faster than z.sh
|
||||
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
|
||||
@@ -235,7 +235,8 @@ end
|
||||
function dump(o)
|
||||
if type(o) == 'table' then
|
||||
local s = '{ '
|
||||
for k,v in pairs(o) do
|
||||
for key, v in pairs(o) do
|
||||
local k = key
|
||||
if type(k) ~= 'number' then k = '"'..k..'"' end
|
||||
s = s .. '['..k..'] = ' .. dump(v) .. ','
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user