File tree 1 file changed +6
-8
lines changed
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -408,19 +408,17 @@ end
408
408
--- @param arg_lead string
409
409
--- @return string[]
410
410
function Capture :autocomplete_refile (arg_lead )
411
- local valid_filenames = self :_get_autocompletion_files (true )
411
+ local valid_files = self :_get_autocompletion_files (true )
412
412
413
- if not arg_lead then
414
- return vim .tbl_keys (valid_filenames )
413
+ if not arg_lead or # arg_lead == 0 then
414
+ return vim .tbl_keys (valid_files )
415
415
end
416
- local parts = vim .split (arg_lead , ' /' , { plain = true })
417
416
418
- local selected_file = valid_filenames [parts [1 ] .. ' /' ]
417
+ local filename = vim .split (arg_lead , ' /' , { plain = true })[1 ]
418
+ local selected_file = valid_files [filename .. ' /' ]
419
419
420
420
if not selected_file then
421
- return vim .tbl_filter (function (file )
422
- return file :match (' ^' .. vim .pesc (parts [1 ]))
423
- end , vim .tbl_keys (valid_filenames ))
421
+ return vim .fn .matchfuzzy (vim .tbl_keys (valid_files ), filename )
424
422
end
425
423
426
424
local headlines = selected_file :get_opened_unfinished_headlines ()
You can’t perform that action at this time.
0 commit comments