#!/bin/bash

fzpath() {
  loc=$(echo "$PATH" | sed -e $'s/:/\\\n/g' | eval "fzf ${FZF_DEFAULT_OPTS} --header='[find:path]'")

  if [[ -d $loc ]]; then
    rg --files "$loc" | rev | cut -d"/" -f1 | rev | eval "fzf ${FZF_DEFAULT_OPTS} --header='[find:exe] => ${loc}' >/dev/null"
    fzpath
  fi
}

fzpath
