#!/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 'exa -1a --color always --icons {} 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