From 9a118cc3cef9f5f54f957f2aa0e7541cad786e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Fr=C3=B6ssman?= Date: Wed, 30 Jul 2014 23:27:08 -0700 Subject: [PATCH] Updated examples (markdown) --- examples.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/examples.md b/examples.md index 922f715..59ef00f 100644 --- a/examples.md +++ b/examples.md @@ -155,6 +155,31 @@ z() { } ``` +Here is another version that also supports relaunching z with the arguments +for the previous command as the default input by using zz + +```sh +z() { + if [[ -z "$*" ]]; then + cd "$(_z -l 2>&1 | sed -n 's/^[ 0-9.,]*//p' | fzf)" + else + _last_z_args="$@" + _z "$@" + fi +} + +zz() { + cd "$(_z -l 2>&1 | sed -n 's/^[ 0-9.,]*//p' | fzf -q $_last_z_args)" +} +``` + +Since z is not very optimal located on a qwerty keyboard I have these aliased as j and jj + +```sh +alias j=z +alias jj=zz +``` + Vim scripts ===========