dotfiles/.bin/dev-src

62 lines
1.5 KiB
Plaintext
Raw Normal View History

2022-12-07 23:28:47 +01:00
#!/bin/sh
. ~/.bin/_config
2023-01-08 17:34:37 +01:00
if [ ! -z "$1" ]
then
QUERY="--query $1"
fi
export INITIAL_QUERY="$1"
2022-12-07 23:28:47 +01:00
2023-01-08 17:34:37 +01:00
cd /usr
( find src \
ports/{archivers,astro,audio,benchmarks} \
ports/{biology,books,cad,chinese,comms} \
ports/{converters,databases,devel,editors} \
ports/{education,emulators,fonts,games} \
ports/{geo,graphics,infrastructure} \
ports/{inputmethods,japanese,java,korean} \
ports/{lang,mail,math,meta,misc,multimedia} \
ports/{mystuff,net,news,plan9,print} \
ports/{productivity,security,shells,sysutils} \
ports/{telephony,textproc,wayland,www,x11} \
2022-12-07 23:28:47 +01:00
-not -path "*/CVS/*" \
-not -path "*/.git/*" \
-type f \
\( -name "*.c" \
-o -name "*.cc" \
-o -name "*.cpp" \
-o -name "*.h" \
-o -name "*.hh" \
-o -name "*.hpp" \
-o -name "*.pl" \
-o -name "*.awk" \
-o -name "*.sh" \
-o -name "*.mk" \
-o -name "*.in" \
-o -name "*conf" \
-o -name "*devs" \
2023-01-08 17:34:37 +01:00
-o -name "patch-*" \
-o -name "Makefile*" \
2022-12-07 23:28:47 +01:00
-o -name "PLIST*" \
-o -name "DESCR*" \
-o -name ".gitignore" \
-o -name ".cvsignore" \
2023-01-08 17:34:37 +01:00
\) > /tmp/dev-src-list.tmp && mv /tmp/dev-src-list.tmp /tmp/dev-src-list ) &
[ ! -f /tmp/dev-src-list ] \
&& wait
F="$(fzf --exact \
--no-sort \
--preview-window=right:65% \
$QUERY \
--preview='highlight -O ansi -O xterm256 --force {}' \
< /tmp/dev-src-list
)"
[ -z "$F" ] || v "$F"