From 426e5a3ea1713cc320d76aa3b65bf959fbb672e9 Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Tue, 10 Oct 2017 00:00:15 +0200 Subject: [PATCH] Update z (consider $_Z_CMD, simplify sed because first column can contain string "common:", ignore z parameters like "-x") --- Examples.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Examples.md b/Examples.md index 051932f..234b433 100644 --- a/Examples.md +++ b/Examples.md @@ -663,11 +663,12 @@ Fish like interactive tab completion for cd in zsh. like normal z when used with arguments but displays an fzf prompt when used without. ```sh -unalias z 2> /dev/null -z() { - [ $# -gt 0 ] && _z "$*" && return - cd "$(_z -l 2>&1 | fzf --height 40% --reverse --inline-info +s --tac --query "$*" | sed 's/^[0-9,.]* *//')" +unalias ${_Z_CMD:-z} 2>/dev/null +function ${_Z_CMD:-z} { + [[ $# -gt 0 ]] && _z $* && return + cd "$(_z -l 2>&1 | sed 's/^[^ ]* *//' | fzf --height 40% --reverse --inline-info +s --tac --query "${*##-* }")" } + ``` Here is another version that also supports relaunching z with the arguments