From 584c679a39c069f1ea18000577efedd880f404e4 Mon Sep 17 00:00:00 2001 From: Linwei Date: Thu, 28 Mar 2019 11:40:03 +0800 Subject: [PATCH] Updated FAQ (markdown) --- FAQ.md | 65 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/FAQ.md b/FAQ.md index a40a1b0..f8102a1 100644 --- a/FAQ.md +++ b/FAQ.md @@ -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 "$@"; } +``` +