Hi Bram, On Sun, Sep 13, 2020 at 12:55 PM Bram Moolenaar <[email protected]> wrote:
> > > > > > > >> On Sat, Sep 12, 2020 at 1:09 PM Prabir Shrestha < > > > > >> [email protected]> wrote: > > > > >> > > > > >>> +1 for adding fuzzy match. > > > > >>> > > > > >>> A bit late to this. But few questions. > > > > >>> > > > > >>> How do we use matchfuzzy for a list of dictionary instead of > item. > > > > >>> > > > > > I can only imagine this being useful if you already have a list of > > > dicts. How often does that happen? > > > > > For example, the getbufinfo(), gettagstack(), readdirex(), getqflist(), > > getloclist(), > > getmatches() and getwininfo() functions return a list of Dicts. > > > > Without the support for fuzzy searching list of Dicts, the user needs > > to first convert it to a List (while still retaining the rest of the > > information > > in the Dict) and then search. > > > > For example, to fuzzy search 'eval' in a list of buffers returned by > > getbufinfo(): > > > > With the support for fuzzy searching a list of Dicts using a 'key': > > > > echo getbufinfo()->matchfuzzy('eval', 'name') > > > > Generating a list of buffer names and then search (but the other > > buffer related information is not kept): > > > > echo getbufinfo()->map({_, v -> v.name})->matchfuzzy('quickfix.c') > > > > Generating a list of lists with two elements and then searching using > > the first element: > > > > echo getbufinfo()->map({_, v -> [v.name, > v]})->matchfuzzy('quickfix') > > > > The first approach is more natural. In the last approach, the user needs > > to generate a temporary list of lists for fuzzy search. > > All makes sense. If you already have a list of dicts and there aren't > too many entries, the conversion to a list of lists is cumbersome. > > Only when you do have a lot of entries (e.g. all files in a directory > tree, with size and date as secondary info) and speed is crucial then > the list of lists may be desired. > > The callback is the most flexible and most likely also the slowest. > > I suspect it's actually not that complicated to support all of these. > We can make the third argument a dict, like we often do for functions > with various options. > > > I have updated the PR #6947 to accept a dict as a third argument. Currently the optional {dict} argument accepts the 'key' and 'callback' items. Regards, Yegappan -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7%3DxfqUwot_SdtjbG0wOFAq%3DvyEeAbkTUoR8A0xcw%3DBvVA%40mail.gmail.com.
