#!/bin/sh

cd /usr/ports

F=$(find * \
    -type f \
    \(     -name "Makefile" \
        -o -name "PLIST*" \
        -o -name "DESCR" \
        -o -name "distinfo" \
        -o -name "patch-*" \
        -o -name "README*" \
        -o -name "Makefile" \
    \) \
        -not -path "pobj/*" \
        -not -path "infrastructure/*" \
        -not -path "packages/*" \
        -not -path "plist/*" \
        -not -path "logs/*" \
        -not -path "CVS/*" \
        | fzf \
            --exact \
            --no-sort \
            --preview-window=right:65% \
            --preview='highlight -O ansi -O xterm256 --force {}' \
);

test -z "$F" \
    || vim "$F";
