Open ttrei opened 4 years ago
This works for me:
function zii() { local dir="$(z -l "$@"|fzf --nth 2.. --reverse --inline-info --tac +s -e --height 35%)" [ -n "$dir" ] && cd "$(echo $dir | tr -s ' ' | cut -d ' ' -f 2)" }
Thanks , fixed with a better version:
function zii() {
local $dir="$(z -l "$@"|fzf --nth 2.. --reverse --inline-info --tac +s -e --height 35%)"
[ -n "$dir" ] && cd "$(echo $dir | sed -e 's/^\S*\s*//')"
}
Because tr -s ' ' | cut -d ' ' -f 2
will fail when dir names contain spaces. sed
is accurate and safe.
https://github.com/skywind3000/z.lua/wiki/Effective-with-fzf#define-a-new-z--i
In bash it fails like this:
This works for me: