Skip to content

Commit f638730

Browse files
author
skywind3000
committed
update doc and aliases
1 parent b9e8501 commit f638730

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

README.cn.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ z.lua 是一个快速路径切换工具,它会跟踪你在 shell 下访问过
1818
- 使用增强匹配算法,更准确的带你去到你想去的地方。
1919
- 低占用,能够仅在当前路径改变时才更新数据库(将 `$_ZL_ADD_ONCE` 设成 1)。
2020
- 交互选择模式,如果有多个匹配结果的话,跳转前允许你进行选择。
21-
- 集成 fzf (可选),可以用来做可视化选择或者 bash 参数补全
21+
- 集成 fzf (可选),可以用来做可视化选择或者参数补全
2222
- 快速跳转到父目录,或者项目根目录,代替反复 “cd ../../.." 。
2323
- 兼容 lua 5.1, 5.2 和 5.3 以上版本。
2424
- 自包含且无额外依赖,单个 `z.lua` 文件完成所有工作。
@@ -321,6 +321,8 @@ eval "$(lua /path/to/z.lua --init bash enhanced once echo fzf)"
321321

322322
有了 fzf 的帮助,bash 下补全也非常方便了。注意看左边的权重,fzf 搜索过滤的顺序是有讲究的,Frecent 权重越高的越靠前,不是乱排序的,更不是简单的按字符串字母排序。这里完全保证权重越高的路径越靠前。
323323

324+
`z.lua` 可以同 [fz](https://github.com/changyuheng/fz) 协作以提供**更好的补全结果**,详细见 [FAQ](https://github.com/skywind3000/z.lua/wiki/FAQ#fzsh-for-better-completion)
325+
324326
注意:该功能在初始化 z.lua 之前,会检测 $PATH 中是否有 fzf 这个程序,有的话才启用。
325327

326328

@@ -390,7 +392,7 @@ FN="$HOME/.local/share/autojump/autojump.txt"
390392
awk -F '\t' '{print $2 "|" $1 "|" 0}' $FN >> ~/.zlua
391393
```
392394

393-
395+
要更好的使用 `z.lua`,别忘记阅读:[Frequently Asked Questions](https://github.com/skywind3000/z.lua/wiki/FAQ)
394396

395397

396398
## Benchmark

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ For example, `z foo bar` would match `/foo/bar` but not `/bar/foo`.
1919
- **10x** times faster than **fasd** and **autojump**, **3x** times faster than **z.sh**.
2020
- Available for **posix shells**: bash, zsh, dash, sh, ash, ksh, busybox and etc.
2121
- Available for Fish Shell, Power Shell and Windows cmd.
22-
- Enhanced matching mode takes you to where ever you want precisely.
22+
- [Enhanced matching algorithm](#enhanced-matching) takes you to where ever you want precisely.
2323
- Allow updating database only if `$PWD` changed with "$_ZL_ADD_ONCE" set to 1.
2424
- Interactive selection enables you to choose where to go before cd.
25-
- Intergrated with FZF (optional) for interactive selection and bash completion.
25+
- Intergrated with FZF (optional) for interactive selection and completion.
2626
- Quickly go back to a parent directory instead of typing "cd ../../..".
27+
- 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).
2728
- Corresponding experience in different shells and operating systems.
2829
- Compatible with Lua 5.1, 5.2 and 5.3+
2930
- 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
262263

263264
NOTE: for fish shell, this feature requires fish 2.7.0 or above.
264265

266+
265267
## FZF Supports
266268

267269
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
274276

275277
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.
276278

277-
`"z -I ."` or `"zf ."` can be used to use fzf select from entire database.
279+
`"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.
278280

279281
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.
280282

@@ -338,10 +340,13 @@ Then press `<tab>` after `z xxx`:
338340

339341
![](images/complete-2.png)
340342

341-
With the help of fzf, completion in bash is much easier now.
343+
With the help of fzf, completion in bash is much easier now.
344+
345+
`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).
342346

343347
NOTE: To enable this, command `fzf` must be found in `$PATH` before initialization.
344348

349+
345350
## Most Recently Accessed Path
346351

347352
`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
372377
alias zh='z -I -t .'
373378
```
374379

375-
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:
380+
The new alias `zh` (jump to history) is very easy to input:
376381

377382
![](images/mru.png)
378383

@@ -389,8 +394,8 @@ Remember to enable the [enhanced matching](#enhanced-matching) algorithm, the cu
389394
Recommended aliases you may find useful:
390395

391396
```bash
392-
alias zc='z -c' # restrict matches to subdirs of $PWD
393-
alias zz='z -i' # cd with interactive selection
397+
alias zz='z -c' # restrict matches to subdirs of $PWD
398+
alias zi='z -i' # cd with interactive selection
394399
alias zf='z -I' # use fzf to select in multiple matches
395400
alias zb='z -b' # quickly cd to the parent directory
396401
```
@@ -409,6 +414,7 @@ FN="$HOME/.local/share/autojump/autojump.txt"
409414
awk -F '\t' '{print $2 "|" $1 "|" 0}' $FN >> ~/.zlua
410415
```
411416

417+
Don't forget to read the [Frequently Asked Questions](https://github.com/skywind3000/z.lua/wiki/FAQ).
412418

413419

414420
## Benchmark

z.lua.plugin.zsh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if [[ -z "$ZLUA_EXEC" ]]; then
2020
fi
2121
fi
2222

23+
export _ZL_FZF_FLAG="-e"
2324

2425
eval "$($ZLUA_EXEC $ZLUA_SCRIPT --init zsh once enhanced)"
2526

0 commit comments

Comments
 (0)