@@ -5,21 +5,11 @@ return {
55 {
66 name = ' buffer' ,
77 source = function ()
8+ local command = require (' wincent.commandt' ).default_options ().finders .buffer .candidates ()
89 local scanner = require (' wincent.commandt.private.scanners.list' ).scanner
910 return {
1011 scanner = function ()
11- local handles = vim .api .nvim_list_bufs ()
12- local paths = {}
13- for _ , handle in ipairs (handles ) do
14- if vim .api .nvim_buf_is_loaded (handle ) then
15- local name = vim .api .nvim_buf_get_name (handle )
16- if name ~= ' ' then
17- local relative = vim .fn .fnamemodify (name , ' :~:.' )
18- table.insert (paths , relative )
19- end
20- end
21- end
22- return scanner (paths )
12+ return scanner (command )
2313 end ,
2414 }
2515 end ,
@@ -222,22 +212,32 @@ return {
222212 {
223213 name = ' find' ,
224214 source = function ()
225- local command = ' find -L . -type f -print0 2> /dev/null'
226- local drop = 2
215+ local command = require (' wincent.commandt' ).default_options ().finders .find .command (' ' )
227216 local scanner = require (' wincent.commandt.private.scanners.command' ).scanner
228217 return {
229218 scanner = function ()
230- return scanner (command , drop )
219+ return scanner (command )
231220 end ,
232221 }
233222 end ,
223+ stub = function ()
224+ assert (_G .vim == nil )
225+ _G .vim = {
226+ startswith = function ()
227+ return false
228+ end ,
229+ }
230+ end ,
231+ unstub = function ()
232+ _G .vim = nil
233+ end ,
234234 times = times ,
235235 skip_in_ci = false ,
236236 },
237237 {
238238 name = ' git' ,
239239 source = function ()
240- local command = ' git ls-files --exclude-standard --cached -z 2> /dev/null '
240+ local command = require ( ' wincent.commandt ' ). default_options (). finders . git . command ( ' ' , {})
241241 local scanner = require (' wincent.commandt.private.scanners.command' ).scanner
242242 return {
243243 scanner = function ()
@@ -251,14 +251,25 @@ return {
251251 {
252252 name = ' rg' ,
253253 source = function ()
254- local command = ' rg --files --null 2> /dev/null '
254+ local command = require ( ' wincent.commandt ' ). default_options (). finders . rg . command ( ' ' )
255255 local scanner = require (' wincent.commandt.private.scanners.command' ).scanner
256256 return {
257257 scanner = function ()
258258 return scanner (command )
259259 end ,
260260 }
261261 end ,
262+ stub = function ()
263+ assert (_G .vim == nil )
264+ _G .vim = {
265+ startswith = function ()
266+ return false
267+ end ,
268+ }
269+ end ,
270+ unstub = function ()
271+ _G .vim = nil
272+ end ,
262273 times = times ,
263274 skip_in_ci = true ,
264275 },
0 commit comments