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.