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

Updated FAQ (markdown)

Linwei
2019-03-28 11:40:03 +08:00
parent bd51206265
commit 584c679a39
+33 -32
@@ -1,35 +1,3 @@
## fz.sh for better completion
[fz](https://github.com/changyuheng/fz) is a bash/zsh plugin that seamlessly adds fuzzy search to tab completion of z.sh. `z.lua` can work with it for better completion result, just define a `_z` function and pass all the arguments to `_zlua` before sourcing fz.sh:
```bash
FZ_HISTORY_CD_CMD="_zlua"
source /path/to/fz.sh
```
If you are using zsh with antigen, initialize them like this:
```bash
antigen boundle skywind3000/z.lua
antigen boundle changyuheng/fz
function _z() { _zlua "$@"; }
```
## How to use `z` as `cd` ?
Paste this script in your `.bashrc` / `.zshrc`:
```bash
function j() {
if [[ "$argv[1]" == "-"* ]]; then
z "$@"
else
cd "$@" 2> /dev/null || z "$@"
fi
}
```
When you are using `j xxx` it will first try `cd xxx` and then `z xxx` if cd failed.
## How to import data from bash / zsh command history ?
Issue [#46](https://github.com/skywind3000/z.lua/issues/46) asked for a script to import some history path from bash command history after a fresh install of z.lua and [@antonalekseev](https://github.com/antonalekseev) provided two script below:
@@ -45,6 +13,20 @@ for zsh:
These two scripts above can be used for pre-warm `.zlua` database.
## How to use `z` as `cd` ?
Paste this script in your `.bashrc` / `.zshrc`:
```bash
function j() {
if [[ "$argv[1]" == "-"* ]]; then
z "$@"
else
cd "$@" 2> /dev/null || z "$@"
fi
}
```
When you are using `j xxx` it will first try `cd xxx` and then `z xxx` if cd failed.
## Define a new `z -I`
Define a new `zii` shell function to override `z -I`:
@@ -80,3 +62,22 @@ export RANGER_ZLUA="/path/to/z.lua"
```
The integration script provides a `z` command in ranger. It also tracks directories changes in ranger.
## fz.sh for better completion
[fz](https://github.com/changyuheng/fz) is a bash/zsh plugin that seamlessly adds fuzzy search to tab completion of z.sh. `z.lua` can work with it for better completion result, just define a `_z` function and pass all the arguments to `_zlua` before sourcing fz.sh:
```bash
FZ_HISTORY_CD_CMD="_zlua"
source /path/to/fz.sh
```
If you are using zsh with antigen, initialize them like this:
```bash
antigen boundle skywind3000/z.lua
antigen boundle changyuheng/fz
function _z() { _zlua "$@"; }
```