From 94bbb772c58d76915b615bffb9950484d04414ec Mon Sep 17 00:00:00 2001 From: Linwei Date: Tue, 19 Feb 2019 14:10:34 +0800 Subject: [PATCH] Updated FAQ (markdown) --- FAQ.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index f30c0a0..bdb1eb8 100644 --- a/FAQ.md +++ b/FAQ.md @@ -14,4 +14,19 @@ antigen boundle skywind3000/z.lua antigen boundle changyuheng/fz function _z() { _zlua "$@"; } -``` \ No newline at end of file +``` + +## 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.