1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-06-30 18:08:51 +00:00

update doc and aliases

This commit is contained in:
skywind3000
2019-02-17 17:24:29 +08:00
parent b9e8501b71
commit f638730d5f
3 changed files with 18 additions and 9 deletions
+4 -2
View File
@@ -18,7 +18,7 @@ z.lua 是一个快速路径切换工具,它会跟踪你在 shell 下访问过
- 使用增强匹配算法,更准确的带你去到你想去的地方。
- 低占用,能够仅在当前路径改变时才更新数据库(将 `$_ZL_ADD_ONCE` 设成 1)。
- 交互选择模式,如果有多个匹配结果的话,跳转前允许你进行选择。
- 集成 fzf (可选),可以用来做可视化选择或者 bash 参数补全。
- 集成 fzf (可选),可以用来做可视化选择或者参数补全。
- 快速跳转到父目录,或者项目根目录,代替反复 “cd ../../.." 。
- 兼容 lua 5.1, 5.2 和 5.3 以上版本。
- 自包含且无额外依赖,单个 `z.lua` 文件完成所有工作。
@@ -321,6 +321,8 @@ eval "$(lua /path/to/z.lua --init bash enhanced once echo fzf)"
有了 fzf 的帮助,bash 下补全也非常方便了。注意看左边的权重,fzf 搜索过滤的顺序是有讲究的,Frecent 权重越高的越靠前,不是乱排序的,更不是简单的按字符串字母排序。这里完全保证权重越高的路径越靠前。
`z.lua` 可以同 [fz](https://github.com/changyuheng/fz) 协作以提供**更好的补全结果**,详细见 [FAQ](https://github.com/skywind3000/z.lua/wiki/FAQ#fzsh-for-better-completion)。
注意:该功能在初始化 z.lua 之前,会检测 $PATH 中是否有 fzf 这个程序,有的话才启用。
@@ -390,7 +392,7 @@ FN="$HOME/.local/share/autojump/autojump.txt"
awk -F '\t' '{print $2 "|" $1 "|" 0}' $FN >> ~/.zlua
```
要更好的使用 `z.lua`,别忘记阅读:[Frequently Asked Questions](https://github.com/skywind3000/z.lua/wiki/FAQ)。
## Benchmark
+13 -7
View File
@@ -19,11 +19,12 @@ For example, `z foo bar` would match `/foo/bar` but not `/bar/foo`.
- **10x** times faster than **fasd** and **autojump**, **3x** times faster than **z.sh**.
- Available for **posix shells**: bash, zsh, dash, sh, ash, ksh, busybox and etc.
- Available for Fish Shell, Power Shell and Windows cmd.
- Enhanced matching mode takes you to where ever you want precisely.
- [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.
- Intergrated with FZF (optional) for interactive selection and bash completion.
- Intergrated with FZF (optional) for interactive selection and completion.
- Quickly go back to a parent directory instead of typing "cd ../../..".
- Cooperate with [fz](https://github.com/changyuheng/fz) to provide better completion, see [FAQ](https://github.com/skywind3000/z.lua/wiki/FAQ#fzsh-for-better-completion).
- Corresponding experience in different shells and operating systems.
- Compatible with Lua 5.1, 5.2 and 5.3+
- Self contained, distributed as a single `z.lua` script, no other dependence.
@@ -262,6 +263,7 @@ And then you can input the number and choose where to go before actual cd. eg. i
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.
@@ -274,7 +276,7 @@ Of course, you can always give more keywords to `z` command to match your destin
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.
`"z -I ."` or `"zf ."` can be used to use fzf select from entire database. Environment variable `_ZL_FZF_FLAG` is for passing additional arguments to fzf, you can try to set it to `-e` to use `exact` matching mode in fzf.
NOTE: For fish shell, this feature requires fish 2.7.0 or above. You can specify fzf executable in `$_ZL_FZF` environment variable, `"fzf"` will be called by default.
@@ -338,10 +340,13 @@ Then press `<tab>` after `z xxx`:
![](images/complete-2.png)
With the help of fzf, completion in bash is much easier now.
With the help of fzf, completion in bash is much easier now.
`z.lua` can cooperate with [fz](https://github.com/changyuheng/fz) for **better completion** result in both bash and zsh, for more information see [FAQ](https://github.com/skywind3000/z.lua/wiki/FAQ#fzsh-for-better-completion).
NOTE: To enable this, command `fzf` must be found in `$PATH` before initialization.
## Most Recently Accessed Path
`z.lua` provides a fast way to visit MRU directories without typing any keyword. That is `dirstack`, which records recently visited paths and can be manipulated by `z -`, `z --` and `z -{num}`:
@@ -372,7 +377,7 @@ There is another way to access MRU directories interactively by utilizing parame
alias zh='z -I -t .'
```
The new alias `zh` (jump to history) uses a parameter `-t` to sort the result by time and `-I` to use `fzf` for selection. the result is:
The new alias `zh` (jump to history) is very easy to input:
![](images/mru.png)
@@ -389,8 +394,8 @@ Remember to enable the [enhanced matching](#enhanced-matching) algorithm, the cu
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
alias zz='z -c' # restrict matches to subdirs of $PWD
alias zi='z -i' # cd with interactive selection
alias zf='z -I' # use fzf to select in multiple matches
alias zb='z -b' # quickly cd to the parent directory
```
@@ -409,6 +414,7 @@ FN="$HOME/.local/share/autojump/autojump.txt"
awk -F '\t' '{print $2 "|" $1 "|" 0}' $FN >> ~/.zlua
```
Don't forget to read the [Frequently Asked Questions](https://github.com/skywind3000/z.lua/wiki/FAQ).
## Benchmark
+1
View File
@@ -20,6 +20,7 @@ if [[ -z "$ZLUA_EXEC" ]]; then
fi
fi
export _ZL_FZF_FLAG="-e"
eval "$($ZLUA_EXEC $ZLUA_SCRIPT --init zsh once enhanced)"