mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-27 01:38:33 -05:00
23 lines
510 B
Bash
Executable File
23 lines
510 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
# Description: Run fzf and go to the directory of the file selected
|
|
#
|
|
# Shell: POSIX compliant
|
|
# Author: Anna Arad
|
|
|
|
. "$(dirname "$0")"/.nnn-plugin-helper
|
|
|
|
if [ "$(cmd_exists fzf)" -eq "0" ]; then
|
|
sel=$(fd --type d --follow --hidden --exclude .git | fzf --preview 'tree -La 1 -C --dirsfirst {} 2>/dev/null')
|
|
else
|
|
exit 1
|
|
fi
|
|
|
|
if [ -n "$sel" ]; then
|
|
# Check if selected path returned by fzf command is absolute
|
|
case $sel in
|
|
/*) nnn_cd "$sel" ;;
|
|
*) nnn_cd "$PWD/$sel" ;;
|
|
esac
|
|
fi
|