@@ -11,160 +11,6 @@ Vim/Neovim Fuzzy Finder plugin powered by
1111
1212It is also used to develop extensions of Fall.
1313
14- ## Usage
15-
16- ``` ts
17- // Import Fall standard library functions and built-in utilities
18- import {
19- composeRenderers ,
20- type Entrypoint ,
21- pipeProjectors ,
22- } from " jsr:@vim-fall/std@^0.1.0" ; // Fall standard library
23- import * as builtin from " jsr:@vim-fall/std@^0.1.0/builtin" ; // Built-in Fall utilities
24-
25- // Define custom actions for file handling, quickfix, and other operations
26- const myPathActions = {
27- ... builtin .action .defaultOpenActions ,
28- ... builtin .action .defaultSystemopenActions ,
29- ... builtin .action .defaultCdActions ,
30- };
31-
32- const myQuickfixActions = {
33- ... builtin .action .defaultQuickfixActions ,
34- " quickfix:qfreplace" : builtin .action .quickfix ({
35- after: " Qfreplace" , // Using the "Qfreplace" plugin for replacing text in quickfix
36- }),
37- };
38-
39- const myMiscActions = {
40- ... builtin .action .defaultEchoActions ,
41- ... builtin .action .defaultYankActions ,
42- ... builtin .action .defaultSubmatchActions ,
43- };
44-
45- // Main entry point function for configuring the Fall interface
46- export const main: Entrypoint = (
47- {
48- defineItemPickerFromSource , // Define item pickers from source data
49- defineItemPickerFromCurator , // Define item pickers from curators (e.g., Git grep)
50- refineGlobalConfig , // Refine global settings (e.g., theme and layout)
51- },
52- ) => {
53- // Set up global configuration (layout and theme)
54- refineGlobalConfig ({
55- coordinator: builtin .coordinator .separate , // Use the "separate" layout style
56- theme: builtin .theme .ASCII_THEME , // Apply ASCII-themed UI
57- });
58-
59- // Configure item pickers for "git-grep", "rg", and "file" sources
60- defineItemPickerFromCurator (
61- " git-grep" , // Picker for `git grep` results
62- pipeProjectors (
63- builtin .curator .gitGrep , // Uses Git to search
64- builtin .modifier .relativePath , // Show relative paths
65- ),
66- {
67- previewers: [builtin .previewer .file ], // Preview file contents
68- actions: {
69- ... myPathActions ,
70- ... myQuickfixActions ,
71- ... myMiscActions ,
72- },
73- defaultAction: " open" , // Default action to open the file
74- },
75- );
76-
77- defineItemPickerFromCurator (
78- " rg" , // Picker for `rg` (ripgrep) results
79- pipeProjectors (
80- builtin .curator .rg , // Uses `rg` for searching
81- builtin .modifier .relativePath , // Modify results to show relative paths
82- ),
83- {
84- previewers: [builtin .previewer .file ], // Preview file contents
85- actions: {
86- ... myPathActions ,
87- ... myQuickfixActions ,
88- ... myMiscActions ,
89- },
90- defaultAction: " open" , // Default action to open the file
91- },
92- );
93-
94- // File picker configuration with exclusion filters for unwanted directories
95- defineItemPickerFromSource (
96- " file" , // Picker for files with exclusions
97- pipeProjectors (
98- builtin .source .file ({
99- excludes: [
100- / . * \/ node_modules\/ . * / , // Exclude node_modules
101- / . * \/ . git\/ . * / , // Exclude Git directories
102- / . * \/ . svn\/ . * / , // Exclude SVN directories
103- / . * \/ . hg\/ . * / , // Exclude Mercurial directories
104- / . * \/ . DS_Store$ / , // Exclude macOS .DS_Store files
105- ],
106- }),
107- builtin .modifier .relativePath , // Show relative paths
108- ),
109- {
110- matchers: [builtin .matcher .fzf ], // Use fuzzy search matcher
111- renderers: [composeRenderers (
112- builtin .renderer .smartPath , // Render smart paths
113- builtin .renderer .nerdfont , // Render with NerdFont (requires NerdFont in terminal)
114- )],
115- previewers: [builtin .previewer .file ], // Preview file contents
116- actions: {
117- ... myPathActions ,
118- ... myQuickfixActions ,
119- ... myMiscActions ,
120- },
121- defaultAction: " open" , // Default action to open the file
122- },
123- );
124-
125- // Configure "line" picker for selecting lines in a file
126- defineItemPickerFromSource (" line" , builtin .source .line , {
127- matchers: [builtin .matcher .fzf ], // Use fuzzy search matcher
128- previewers: [builtin .previewer .buffer ], // Preview the buffer content
129- actions: {
130- ... myQuickfixActions ,
131- ... myMiscActions ,
132- ... builtin .action .defaultOpenActions ,
133- ... builtin .action .defaultBufferActions ,
134- },
135- defaultAction: " open" , // Default action to open the line
136- });
137-
138- // Configure "buffer" picker for loaded buffers
139- defineItemPickerFromSource (
140- " buffer" ,
141- builtin .source .buffer ({ filter: " bufloaded" }), // Show only loaded buffers
142- {
143- matchers: [builtin .matcher .fzf ], // Use fuzzy search matcher
144- previewers: [builtin .previewer .buffer ], // Preview the buffer content
145- actions: {
146- ... myQuickfixActions ,
147- ... myMiscActions ,
148- ... builtin .action .defaultOpenActions ,
149- ... builtin .action .defaultBufferActions ,
150- },
151- defaultAction: " open" , // Default action to open the buffer
152- },
153- );
154-
155- // Configure "help" picker for help tags
156- defineItemPickerFromSource (" help" , builtin .source .helptag , {
157- matchers: [builtin .matcher .fzf ], // Use fuzzy search matcher
158- previewers: [builtin .previewer .helptag ], // Preview help tag content
159- actions: {
160- ... myMiscActions ,
161- ... builtin .action .defaultHelpActions , // Help actions
162- },
163- defaultAction: " help" , // Default action is to show help
164- });
165- };
166- ```
167-
16814## License
16915
17016The code in this repository follows the MIT license, as detailed in
0 commit comments