mirror of
https://github.com/skywind3000/z.lua
synced 2026-03-17 13:19:48 +00:00
update doc
This commit is contained in:
26
README.cn.md
26
README.cn.md
@@ -19,7 +19,8 @@ z.lua 是一个快速路径切换工具,它会跟踪你在 shell 下访问过
|
||||
- 兼容 lua 5.1, 5.2 和 5.3 以上版本。
|
||||
- 新增:环境变量 "$_ZL_ADD_ONCE" 设成 1 的话性仅当前路径改变时才更新数据库。
|
||||
- 新增:增强匹配模式,将环境变量 "$_ZL_MATCH_MODE" 设置成 1 可以启用。
|
||||
- 新增:交互选择模式,如果有多个匹配结果的话,跳转前允许你进行选择。
|
||||
- 新增:交互选择模式,如果有多个匹配结果的话,跳转前允许你进行选择。
|
||||
- 新增:支持 fzf 来进行多结果筛选,见后面文档。
|
||||
|
||||
|
||||
## Examples
|
||||
@@ -243,6 +244,20 @@ $ z -i soft
|
||||
|
||||
然后你按照最前面的序号输入你想要去的地方,比如输入 3 就会进入 `/home/data/software`。如果你不输入任何东西直接按回车,那么将会直接退出而不进行任何跳转。
|
||||
|
||||
PS:如果你使用 Fish shell,需要 2.7.0 以上才支持该功能。
|
||||
|
||||
## FZF supports
|
||||
|
||||
版本 1.1.0 引入了新的 `"-I"` 参数,让你可以使用 fzf 在多项结果进行快速选择:
|
||||
|
||||
|
||||

|
||||
|
||||
为了方便起见,通常把 `z -I` alias 成 `zf` (z + fuzzy finder)。如果搜索结果只有一项,那么 z.lua 会直接跳转过去,不需要启动 fzf 再选择一遍,只有多项结果要选择时,才会启动 fzf。
|
||||
|
||||
`"z -I ."` 或者 `"zf ."` 可以让 fzf 来对整个数据库中的路径进行选择。
|
||||
|
||||
PS:如果你使用 Fish shell,需要 2.7.0 以上才支持该功能。
|
||||
|
||||
## Tips
|
||||
|
||||
@@ -251,14 +266,7 @@ $ z -i soft
|
||||
```bash
|
||||
alias zc='z -c' # 严格匹配当前路径的子路径
|
||||
alias zz='z -i' # 使用交互式选择模式
|
||||
```
|
||||
|
||||
同时你可以定义一个名为 `zf` 的命令,搭配 fzf 进行历史路径模糊匹配:
|
||||
|
||||
```bash
|
||||
zf() {
|
||||
cd "$(z -l "$@" 2>&1 | fzf --height 40% --nth 2.. --reverse --inline-info +s --tac | sed 's/^[0-9,.]* *//')"
|
||||
}
|
||||
alias zf='z -I' # 使用 fzf 对多个结果进行选择
|
||||
```
|
||||
|
||||
|
||||
|
||||
26
README.md
26
README.md
@@ -25,7 +25,8 @@ For example, `z foo bar` would match `/foo/bar` but not `/bar/foo`.
|
||||
- Compatible with lua 5.1, 5.2 and 5.3+
|
||||
- New "$_ZL_ADD_ONCE" to allow updating database only if `$PWD` changed.
|
||||
- Enhanced matching mode with "$_ZL_MATCH_MODE" set to 1.
|
||||
- Interactive selection enables you to choose where to go before cd.
|
||||
- Interactive selection enables you to choose where to go before cd.
|
||||
- Support fzf for selecting from multiple results.
|
||||
|
||||
|
||||
## Examples
|
||||
@@ -227,6 +228,20 @@ $ z -i soft
|
||||
|
||||
And then you can input the number and choose where to go before actual cd. eg. input 3 to cd to `/home/data/software`. And if you just press ENTER and input nothing, it will just quit and stay where you were.
|
||||
|
||||
NOTE: for fish shell, this feature requires fish 2.7.0 or above.
|
||||
|
||||
## FZF supports
|
||||
|
||||
From version 1.1.0, a new option `"-I"` will allow you to use fzf to select when there are multiple matches.
|
||||
|
||||

|
||||
|
||||
Usually, `z -I` can be aliased to `zf` (z + fuzzy finder) for convenience. If there are only one path matched, `z -I` will jump to it directly, fzf will only be invoked for multiple matches.
|
||||
|
||||
`"z -I ."` or `"zf ."` can be used to use fzf select from entire database.
|
||||
|
||||
NOTE: for fish shell, this feature requires fish 2.7.0 or above.
|
||||
|
||||
|
||||
## Tips
|
||||
|
||||
@@ -235,14 +250,7 @@ Recommended aliases you may find useful:
|
||||
```bash
|
||||
alias zc='z -c' # restrict matches to subdirs of $PWD
|
||||
alias zz='z -i' # cd with interactive selection
|
||||
```
|
||||
|
||||
And you can define a `zf` command to select history path with fzf:
|
||||
|
||||
```bash
|
||||
zf() {
|
||||
cd "$(z -l "$@" 2>&1 | fzf --height 40% --nth 2.. --reverse --inline-info +s --tac | sed 's/^[0-9,.]* *//')"
|
||||
}
|
||||
alias zf='z -I' # use fzf to select in multiple matches
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user