From 1e297a86930a2d9d0abef5841901d6fe13a731ba Mon Sep 17 00:00:00 2001 From: mgild Date: Thu, 13 Sep 2018 16:20:11 -0700 Subject: [PATCH] Updated Examples (markdown) --- Examples.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Examples.md b/Examples.md index 20934d2..f7218ae 100644 --- a/Examples.md +++ b/Examples.md @@ -799,6 +799,27 @@ v() { #### Integration with [zsh-interactive-cd](https://github.com/changyuheng/zsh-interactive-cd). +Like normal cd but opens an interactive navigation window when called with no arguments +For ls, use -FG instead of --color=always on osx +function cd() { + if [[ "$#" != 0 ]]; then + builtin cd "$@"; + return + fi + while true; do + local lsd=$(echo; echo ".." && ls -p | grep '/$' | sed 's;/$;;') + local dir="$(echo "$lsd" | + fzf --height 40% --reverse --preview ' + echo -n "$(pwd)/" | sed "s;//;/;"; + echo {}; echo; nxt="$(echo {})"; + [[ "$nxt" == "" ]] && echo "Close Navigator" || + ls -p --color=always {} + ')" + [[ ${#dir} != 0 ]] || return 0 + builtin cd "$dir" &> /dev/null + done +} + Fish like interactive tab completion for cd in zsh. ![zsh-interactive-cd-demo](https://raw.githubusercontent.com/changyuheng/zsh-interactive-cd/master/demo.gif)