33 type Entrypoint ,
44 refineCurator ,
55 refineSource ,
6- } from "jsr:@vim-fall/std@^0.3.2" ;
7- import * as builtin from "jsr:@vim-fall/std@^0.3.2/builtin" ;
6+ } from "jsr:@vim-fall/std@^0.4.0" ;
7+ import * as builtin from "jsr:@vim-fall/std@^0.4.0/builtin" ;
8+ import { SEPARATOR } from "jsr:@std/path@^1.0.8/constants" ;
89
910const myPathActions = {
1011 ...builtin . action . defaultOpenActions ,
@@ -26,6 +27,88 @@ const myMiscActions = {
2627 ...builtin . action . defaultSubmatchActions ,
2728} ;
2829
30+ const myFilterFile = ( path : string ) => {
31+ const excludes = [
32+ ".7z" ,
33+ ".DS_Store" ,
34+ ".avi" ,
35+ ".avi" ,
36+ ".bmp" ,
37+ ".class" ,
38+ ".dll" ,
39+ ".dmg" ,
40+ ".doc" ,
41+ ".docx" ,
42+ ".dylib" ,
43+ ".ear" ,
44+ ".exe" ,
45+ ".fla" ,
46+ ".flac" ,
47+ ".flv" ,
48+ ".gif" ,
49+ ".ico" ,
50+ ".id_ed25519" ,
51+ ".id_rsa" ,
52+ ".iso" ,
53+ ".jar" ,
54+ ".jpeg" ,
55+ ".jpg" ,
56+ ".key" ,
57+ ".mkv" ,
58+ ".mov" ,
59+ ".mp3" ,
60+ ".mp4" ,
61+ ".mpeg" ,
62+ ".mpg" ,
63+ ".o" ,
64+ ".obj" ,
65+ ".ogg" ,
66+ ".pdf" ,
67+ ".png" ,
68+ ".ppt" ,
69+ ".pptx" ,
70+ ".rar" ,
71+ ".so" ,
72+ ".swf" ,
73+ ".tar.gz" ,
74+ ".war" ,
75+ ".wav" ,
76+ ".webm" ,
77+ ".wma" ,
78+ ".wmv" ,
79+ ".xls" ,
80+ ".xlsx" ,
81+ ".zip" ,
82+ ] ;
83+ for ( const exclude of excludes ) {
84+ if ( path . endsWith ( exclude ) ) {
85+ return false ;
86+ }
87+ }
88+ return true ;
89+ } ;
90+
91+ const myFilterDirectory = ( path : string ) => {
92+ const excludes = [
93+ "$RECYVLE.BIN" ,
94+ ".cache" ,
95+ ".git" ,
96+ ".hg" ,
97+ ".ssh" ,
98+ ".svn" ,
99+ "__pycache__" , // Python
100+ "build" , // C/C++
101+ "node_modules" , // Node.js
102+ "target" , // Rust
103+ ] ;
104+ for ( const exclude of excludes ) {
105+ if ( path . includes ( `${ SEPARATOR } ${ exclude } ${ SEPARATOR } ` ) ) {
106+ return false ;
107+ }
108+ }
109+ return true ;
110+ } ;
111+
29112export const main : Entrypoint = (
30113 {
31114 defineItemPickerFromSource,
@@ -77,14 +160,8 @@ export const main: Entrypoint = (
77160 "file" ,
78161 refineSource (
79162 builtin . source . file ( {
80- excludes : [
81- / .* \/ n o d e _ m o d u l e s \/ .* / ,
82- / .* \/ .g i t \/ .* / ,
83- / .* \/ .s v n \/ .* / ,
84- / .* \/ .h g \/ .* / ,
85- / .* \/ .s s h \/ .* / ,
86- / .* \/ .D S _ S t o r e $ / ,
87- ] ,
163+ filterFile : myFilterFile ,
164+ filterDirectory : myFilterDirectory ,
88165 } ) ,
89166 builtin . refiner . relativePath ,
90167 ) ,
0 commit comments