m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 08:13:40 -05:00

Updated Examples (markdown)

mgild
2018-09-13 16:20:11 -07:00
parent 48e1551b6f
commit 1e297a8693

@@ -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)