From 0a196d9526b8e19544461c0494c86f6f42da8b23 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 19 Feb 2015 17:09:30 +0900 Subject: [PATCH] Updated Examples (markdown) --- Examples.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Examples.md b/Examples.md index 01e3170..39e2ebb 100644 --- a/Examples.md +++ b/Examples.md @@ -186,10 +186,12 @@ Integration with [z](https://github.com/rupa/z), like normal z when used with arguments but displays an fzf prompt when used without. ```sh -unalias z +[[ "$OSTYPE" =~ darwin ]] && alias tac='tail -r' + +unalias z 2> /dev/null z() { if [[ -z "$*" ]]; then - cd "$(_z -l 2>&1 | sed -n 's/^[ 0-9.,]*//p' | fzf)" + cd "$(_z -l 2>&1 | tac | fzf | sed 's/^[0-9,.]* *//')" else _z "$@" fi @@ -203,7 +205,7 @@ for the previous command as the default input by using zz unalias z z() { if [[ -z "$*" ]]; then - cd "$(_z -l 2>&1 | sed -n 's/^[ 0-9.,]*//p' | fzf)" + cd "$(_z -l 2>&1 | tac | fzf | sed 's/^[0-9,.]* *//')" else _last_z_args="$@" _z "$@" @@ -211,7 +213,7 @@ z() { } zz() { - cd "$(_z -l 2>&1 | sed -n 's/^[ 0-9.,]*//p' | fzf -q $_last_z_args)" + cd "$(_z -l 2>&1 | sed -n 's/^[0-9,.]* *//' | fzf -q $_last_z_args)" } ```