gonvim-fuzzy icon indicating copy to clipboard operation
gonvim-fuzzy copied to clipboard

Add custom command as a file list source

Open geomaster opened this issue 7 years ago • 1 comments

Adds a GonvimFuzzyCmd command which takes a user-provided shell command and uses its output as the list of files for fuzzy searching.

This is useful in git repositories with a large number of non-tracked files, because the ordinary file sources (GonvimFuzzyFiles) doesn't respect .gitignore (AFAICT), so git ls-files can be provided as a custom command to solve this. (This is not very efficient on large repos but is better than nothing.)

geomaster avatar Nov 10 '18 16:11 geomaster

Also, a documentation update in the original gonvim wiki would be nice if this gets merged. Attaching proposed patch.

diff --git a/Configurations.md b/Configurations.md
index e50e4e4..3620f12 100644
--- a/Configurations.md
+++ b/Configurations.md
@@ -69,6 +69,16 @@ GonvimFuzzyFiles   - For Files
 GonvimFuzzyBLines  - For Lines in the Current File
 GonvimFuzzyAg      - For runing FZF_AG ( searches current directory )
 GonvimFuzzyBuffers - For searching opened Buffers
+GonvimFuzzyCmd     - For using a custom command which lists fuzzy search
+                     candidate filenames, which is to be provided as the
+                     first parameter
+```
+
+`GonvimFuzzyFiles` does not respect `.gitignore`, so you can use `git ls-files`
+as a custom command to search only among files tracked by git, for example:
+
+```
+nmap <C-p> :GonvimFuzzyCmd git ls-files<CR>
 ```
 
 ### Workspace

geomaster avatar Nov 10 '18 17:11 geomaster