dotfiles/.bin/s
2023-02-22 08:31:38 +01:00

28 lines
718 B
Bash
Executable File

#!/bin/sh
. ~/.bin/_config
[ ! -z "$1" ] && EXTRA="-q $1"
F=$(find /usr/src /usr/xenocara/ /usr/www/ -type f \
-not -path "*/CVS/*" \
-not -path "*/.git/*" \
-not -path "/usr/src/gnu/*" \
\( -name "*.c" \
-o -name "*.h" \
-o -name "*.pl" \
-o -name "*.inc" \
-o -name "patch-*" \
-o -name "DESCR*" \
-o -name "PLIST*" \
-o -name "PLIST*" \
-o -name "Makefile*" \
\) \
-not -name "*.orig" \
-not -name "*.openbsd.orig" \
| while IFS= read -r l; do echo "${#l} $((++n)) $l"; done \
| sort -n -k 1 \
| cut -d" " -f3- \
| fzf -e -1 -0 +s $EXTRA --preview="cat {1}")
set -xe
R="$(readlink -f "$F")"
test -z "$R" || vim "$R"
echo "$(dirname "$R")"