yegappan / mru

Most Recently Used (MRU) Vim Plugin
Other
259 stars 48 forks source link

Fuzzy search does not respect last used files order #59

Closed fcojavierdomenech closed 2 years ago

fcojavierdomenech commented 2 years ago

This is the order of the MRU files: Captura de Pantalla 2022-08-23 a las 17 19 14

If I type sign-docs I'd expect the first entry to be contract-sign-docs.service.ts

But it seems that the fuzzy is not respecting that order: Captura de Pantalla 2022-08-23 a las 17 22 48

qpkorr commented 2 years ago

For anyone else who comes here thinking "Yes! This Most Recently Used plugin is no longer returning files in their Most Recently Used order!" then wonders why this issue was closed, I'll share the following:

  1. Fuzzy match is the default for vim 8.2.1665 and later
  2. Fuzzy match uses Vim's 'matchfuzzy' command, the help for which says "The strings in the returned list are sorted based on the matching score." So, unless I'm mistaken, the title of this issue is entirely correct for recent Vim versions - which might be considered a violation of the name of the plugin?
    To get the old behaviour with regular expressions, then per the MRU help, let MRU_FuzzyMatch = 0 Fuzzy matching seems good - but I'm curious whether it would be better used to a) get a list of files that match, via fuzzy matching, then b) pluck just those files from s:MRU_files, in their MRU order.
yegappan commented 2 years ago

I have committed 1d96d77d3d7699d72b3ddc697a145e1c5ba8f107 to address this issue.