summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-10 23:20:53 +0300
committerPaul Buetow <paul@buetow.org>2026-04-10 23:20:53 +0300
commit0f5e7bf23efc60cdf3b4fec70b8a8bbc15584bf0 (patch)
tree54967d0c4a23e67662fb751e43fab42945bf2b56
parentae86227a3d5677bc6d3579511633d9fa8dc493e7 (diff)
fish: ignore binary suffixes in quickedit index and picker
Extend quickedit_ignore_suffixes with configurable extensions, filter at index build and after grep, and add Office/ODF and other binary types found in QuickEdit index. Made-with: Cursor
-rw-r--r--fish/conf.d/quickedit.fish44
1 files changed, 42 insertions, 2 deletions
diff --git a/fish/conf.d/quickedit.fish b/fish/conf.d/quickedit.fish
index b41e0a8..42bd52a 100644
--- a/fish/conf.d/quickedit.fish
+++ b/fish/conf.d/quickedit.fish
@@ -1,5 +1,37 @@
set -gx QUICKEDIT_DIR ~/QuickEdit
+# Suffixes treated as binary: omitted from the quickedit index and picker (add as needed).
+set -g quickedit_ignore_suffixes \
+ .pdf .png .jpg .jpeg .gif .webp .bmp .ico .tiff .tif \
+ .zip .tar .gz .tgz .bz2 .xz .7z .rar .zst \
+ .mp3 .mp4 .mkv .avi .wav .flac .webm .mov \
+ .bin .exe .dll .so .dylib .o .a \
+ .woff .woff2 .ttf .eot .otf \
+ .sqlite .db \
+ .doc .docx .ppt .pptx .xls .xlsx \
+ .odt .ods .odg .odp .sxw \
+ .apkg .apk .kdbx .pfx .p12 \
+ .epub .mht .mhtml .gnumeric .abw \
+ .blend .sh3d \
+ .spd .spd-wal .spd-shm
+
+function quickedit::filter_ignore_suffixes
+ set -l out
+ for f in $argv
+ set -l skip 0
+ for suffix in $quickedit_ignore_suffixes
+ if string match -qi "*$suffix" $f
+ set skip 1
+ break
+ end
+ end
+ if test $skip -eq 0
+ set out $out $f
+ end
+ end
+ printf '%s\n' $out
+end
+
function quickedit::postaction
set -l file_path $argv[1]
set -l make_run 0
@@ -49,10 +81,18 @@ function quickedit::run
end
if test $index_age -gt 86400
echo Indexing quickedit
- find -L . -type f -not -path '*/.*' | sort >$QUICKEDIT_DIR/.index.tmp && mv $QUICKEDIT_DIR/.index.tmp $QUICKEDIT_DIR/.index
+ set -l find_args -L . -type f -not -path '*/.*'
+ if test (count $quickedit_ignore_suffixes) -gt 0
+ set find_args $find_args '('
+ for suffix in $quickedit_ignore_suffixes
+ set find_args $find_args ! -name "*$suffix"
+ end
+ set find_args $find_args ')'
+ end
+ find $find_args | sort >$QUICKEDIT_DIR/.index.tmp && mv $QUICKEDIT_DIR/.index.tmp $QUICKEDIT_DIR/.index
end
- set files (grep -E "$grep_pattern" $QUICKEDIT_DIR/.index)
+ set files (quickedit::filter_ignore_suffixes (grep -E "$grep_pattern" $QUICKEDIT_DIR/.index))
switch (count $files)
case 0
echo No result found