From b580d142f45e93fd86608e25e2beef3c06752469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Fr=C3=B6ssman?= Date: Thu, 10 Jul 2014 17:52:18 -0700 Subject: [PATCH] Updated examples (markdown) --- examples.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/examples.md b/examples.md index d7406d5..bbe60da 100644 --- a/examples.md +++ b/examples.md @@ -139,6 +139,22 @@ fs() { } ``` +z +- + +Integration with [z](https://github.com/rupa/z), like normal z when used with +arguments but displays an fzf prompt when used without. + +```sh +z() { + if [[ -z "$*" ]]; then + cd "$(_z -l 2>&1 | sed -n 's/^[ 0-9.,]*//p' | fzf)" + else + local reporoot="$(command git rev-parse --show-toplevel 2> /dev/null)" + _z $reporoot "$@" + fi +} +``` Vim scripts =========== @@ -159,7 +175,7 @@ command! -nargs=1 AgFZF call fzf#run({ function! AgHandler(l) let keys = split(a:l,':') execute 'tabe +' . keys[-2] . ' ' . escape(keys[-1], ' ') -endfunction +endfunction function! Arghandler(l) return "ag -i " . a:l . " | sed 's@\\(.[^:]*\\):\\(.[^:]*\\):\\(.*\\)@\\3:\\2:\\1@' "