Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-12-25 Fir de Conversatie Yegappan Lakshmanan
Hi, On Wed, Dec 23, 2020 at 4:45 AM lacygoill wrote: > @yegappan I haven't had the time to write a > proper feature request, but I think it would be useful for matchfuzzypos() > to also give the score for each string. > Currently matchfuzzypos() function returns tw

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-10-18 Fir de Conversatie Yegappan Lakshmanan
Hi, On Mon, Sep 14, 2020 at 10:56 AM Maxim Kim wrote: > However, this would match: > :echo matchfuzzy(["pack/minpac/opt/fzf/LICENSE"], "pa/li") > ['pack/minpac/opt/fzf/LICENSE'] > > I would expect :echo matchfuzzy(["pack/minpac/opt/fzf/LICENSE"], "pali") > match the same... > > So should matchfu

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-10-18 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sun, Oct 4, 2020 at 7:10 PM lacygoill wrote: > There is something else which I think would be useful but it's more a > feature request. If you use fzf(1) to search through help tags via > :Helptags >

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-10-13 Fir de Conversatie Maxim Kim
And another similar to quickpick plugin using matchfuzzypos() https://github.com/habamax/vim-select Thank you for implementing fuzzy functions! понедельник, 12 октября 2020 г. в 01:41:52 UTC+3, Prabir Shrestha: > Here is another vim plugin which I rewrote using the new matchfuzzy and > matchf

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-10-10 Fir de Conversatie Yegappan Lakshmanan
Hi all, On Fri, Sep 11, 2020 at 3:51 PM Yegappan Lakshmanan wrote: > Hi, > > On Fri, Sep 11, 2020 at 5:54 AM Bram Moolenaar > wrote: > >> A few practical usage examples would help. >> >> >> > To demonstrate the use of the new matchfuzzy() function, I have created a > file selector plugin: > > h

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-10-05 Fir de Conversatie ma...@prabir.me
If you are porting might be good to look into comparing and porting other libraries. Would be also good to trying in real big projects such as chromium. https://github.com/wincent/command-t - C (actual search algorithm is in C) https://github.com/jhawthorn/fzy - C https://github.com/lotabout/s

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-10-05 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sun, Oct 4, 2020 at 7:10 PM lacygoill wrote: > If you have any comments about the function arguments and the return > values, please let me know. We cannot change this after some time. > > I haven't had the time to read all the comments, but I'm using > matchfuzzypos(), and I had difficul

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-10-05 Fir de Conversatie Bram Moolenaar
[...] > I would like to simplify this code by passing the output of > `matchfuzzypos()` directly to `filter()` so that it removes the > entries where a match is located after the tab. But I can't do it, > because if `filter()` removes one tag name from `taglist_filtered`, > the next time `pos[i

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-19 Fir de Conversatie Yegappan Lakshmanan
Hi, On Wed, Sep 16, 2020 at 3:23 AM Maxim Kim wrote: > > > вторник, 15 сентября 2020 г. в 22:34:33 UTC+3, bfrg: > >> But matchfuzzy() returns only a list of byte indexes (column numbers). >> >> Does that mean we wouldn't be able to match unicode (cyrillic for > example)? > > I have now updated

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-18 Fir de Conversatie Yegappan Lakshmanan
Hi Bram, On Wed, Sep 16, 2020 at 12:50 PM Bram Moolenaar wrote: > > Yegappan wrote: > > > On Wed, Sep 16, 2020 at 8:56 AM Bram Moolenaar > wrote: > > > > > > > > > On Wed, Sep 16, 2020 at 3:23 AM Maxim Kim wrote: > > > > > > > > > =D0=B2=D1=82=D0=BE=D1=80=D0=BD=D0=B8=D0=BA, 15 > =D1=81=D0=B5=D

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-16 Fir de Conversatie Bram Moolenaar
Yegappan wrote: > On Wed, Sep 16, 2020 at 8:56 AM Bram Moolenaar wrote: > > > > > > On Wed, Sep 16, 2020 at 3:23 AM Maxim Kim wrote: > > > > > > > =D0=B2=D1=82=D0=BE=D1=80=D0=BD=D0=B8=D0=BA, 15 =D1=81=D0=B5=D0=BD=D1= > =82=D1=8F=D0=B1=D1=80=D1=8F 2020 =D0=B3. =D0=B2 22:34:33 UTC+3, bfrg: > >

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-16 Fir de Conversatie Yegappan Lakshmanan
Hi Bram, On Wed, Sep 16, 2020 at 8:56 AM Bram Moolenaar wrote: > > > On Wed, Sep 16, 2020 at 3:23 AM Maxim Kim wrote: > > > > > вторник, 15 сентября 2020 г. в 22:34:33 UTC+3, bfrg: > > > > > >> But matchfuzzy() returns only a list of byte indexes (column > numbers). > > >> > > >> Does that mea

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-16 Fir de Conversatie Bram Moolenaar
> On Wed, Sep 16, 2020 at 3:23 AM Maxim Kim wrote: > > > вторник, 15 сентября 2020 г. в 22:34:33 UTC+3, bfrg: > > > >> But matchfuzzy() returns only a list of byte indexes (column numbers). > >> > >> Does that mean we wouldn't be able to match unicode (cyrillic for > > example)? > > Currently

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-16 Fir de Conversatie Yegappan Lakshmanan
Hi, On Wed, Sep 16, 2020 at 3:23 AM Maxim Kim wrote: > > > вторник, 15 сентября 2020 г. в 22:34:33 UTC+3, bfrg: > >> But matchfuzzy() returns only a list of byte indexes (column numbers). >> >> Does that mean we wouldn't be able to match unicode (cyrillic for > example)? > > Currently the matc

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-16 Fir de Conversatie Maxim Kim
вторник, 15 сентября 2020 г. в 22:34:33 UTC+3, bfrg: > But matchfuzzy() returns only a list of byte indexes (column numbers). > > Does that mean we wouldn't be able to match unicode (cyrillic for example)? > — > You are receiving this because you commented. > Reply to this email directly, v

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-15 Fir de Conversatie Yegappan Lakshmanan
Hi, On Tue, Sep 15, 2020 at 12:34 PM bfrg wrote: > @yegappan The way @prabirshrestha > needs it is inside another list: > > [ > [ "curl", "world", "curl world"], > [ > [ [2,3] ], > [ [2,3 ] ], > [

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-15 Fir de Conversatie Yegappan Lakshmanan
Hi, On Tue, Sep 15, 2020 at 12:04 PM Prabir Shrestha wrote: > Try this and search for oa instead. > > echo 'foobar foobar' | fzf > > > In this case also, only the 'oa' in the first foobar is highlighted. The 'oa' in the second 'foobar' is not highlighted. - Yegappan -- -- You received this m

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-15 Fir de Conversatie Yegappan Lakshmanan
Hi, On Tue, Sep 15, 2020 at 10:57 AM Prabir Shrestha wrote: > I commented in PR. It is starting to look good. Currently my big concern > is about multiple highlights for the same item. > > Result should look like this. when using matchfuzzypos(['curl', 'world', > 'curl world'], 'rl'). Need to cr

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-15 Fir de Conversatie Yegappan Lakshmanan
Hi, On Tue, Sep 15, 2020 at 11:31 AM bfrg wrote: > Why do you need a list of lists? > For each matching string, the list of matching byte positions is returned. For example, echo matchfuzzypos(['spice', 'nice'], 'ice') returns [['nice', 'spice'], [[1, 2, 3], [2, 3, 4]]]. In the above out

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-15 Fir de Conversatie Bram Moolenaar
Prabir Shrestha wrote: > It is really not about `results[39:49]` but about the `setline`. > > If you merge you need to do this which means it is doing for loop in vimscr= > ipt and is slow. > > ```vim > let i = 1 > for item in results[39:49] > call setline(1, [item[0]]) > let i += 1 >

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-15 Fir de Conversatie Yegappan Lakshmanan
Hi all, I have updated PR #6947 with the support for returning the list of matching positions in addition to the matching strings. This PR also includes the changes for fuzzy matching a list of dictionaries. https://github.com/vim/vim/pull/6947 If you have any comments about the function argumen

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-14 Fir de Conversatie Maxim Kim
On 14.09.2020 17:38, Bram Moolenaar wrote: Sergey Vlasov wrote: ... ``` [ ["clay", ["c", 0, 0], ["ay", 2, 3] ] ] ``` That makes it a lot more complex. What is the practical use for the match positions? Something like this is needed if one wants to highlight matc

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-14 Fir de Conversatie Yegappan Lakshmanan
Hi, On Mon, Sep 14, 2020 at 12:52 PM Prabir Shrestha wrote: > matchfuzzypos sounds good to me. Thought I would prefer different type > for results. > > [ > \ ['string1', 'string2'], > \ [ [[0, 2, 4]], [[1,3,5]] ] > \ ] > > or > > { > \ 'items': ['string1', 'string2'], > \ 'highlights'

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-14 Fir de Conversatie Yegappan Lakshmanan
Hi, On Mon, Sep 14, 2020 at 10:13 AM Bram Moolenaar wrote: > > > > Internally, the fuzzy_match() function does have this information in > > > an array (matches). But returning this for a large number of matched > > > items will increase the run time of this function. As Bram asked, > > > what is

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-14 Fir de Conversatie Dominique Pellé
Maxim Kim wrote: > To be able to show the user what was matched, like fzf, leaderf, vim-clap or > ctrlp do: > > https://i.imgur.com/FogkBBH.png In your screenshot example I see that the search string is "pa li" (with a space) and the results don't contain spaces. They contain slashes as in "pac

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-14 Fir de Conversatie Yegappan Lakshmanan
Hi, On Mon, Sep 14, 2020 at 2:18 AM Sergey Vlasov wrote: > With the proposed API there is no way to know what portions of the input > are matched. > > Example: > > :echo matchfuzzy(['clay', 'crow'], "cay") > < results in ['clay']. > > > It would be more useful to also return the

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-14 Fir de Conversatie Bram Moolenaar
Sergey Vlasov wrote: > With the proposed API there is no way to know what portions of the > input are matched. > > ``` > Example: > > :echo matchfuzzy(['clay', 'crow'], "cay") > < results in ['clay']. > > ``` > > It would be more useful to also return the start position and the

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-13 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sun, Sep 13, 2020 at 6:40 PM Prabir Shrestha wrote: > Actually key_cb won’t make sense since it can be nested key or some > computation with function. It is more of value_cb or can use something like > filtertext_cb or text_cb to align with lsp. > > > I have changed the name to 'text_cb'

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-13 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sun, Sep 13, 2020 at 3:45 PM Prabir Shrestha wrote: > Should it be called map_cb instead of callback to align with channels? > > > As this function returns the name of the key, should we call this key_cb instead? - Yegappan -- -- You received this message from the "vim_dev" maillist.

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-13 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sun, Sep 13, 2020 at 2:44 PM Prabir Shrestha wrote: > Would it be possible to take a dict but instead of using key or callback > name it map or something else but make the inner implementation smarter? > > let result = matchfuzzy(items, 'search', { 'map': 'v:val["word"]' }) > > If map is

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-13 Fir de Conversatie Yegappan Lakshmanan
Hi Bram, On Sun, Sep 13, 2020 at 12:55 PM Bram Moolenaar wrote: > > > > > > > >> On Sat, Sep 12, 2020 at 1:09 PM Prabir Shrestha < > > > > >> vim-dev-git...@256bit.org> wrote: > > > > >> > > > > >>> +1 for adding fuzzy match. > > > > >>> > > > > >>> A bit late to this. But few questions. > > > >

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-13 Fir de Conversatie Bram Moolenaar
Yegappan wrote: > On Sun, Sep 13, 2020 at 3:44 AM Bram Moolenaar wrote: > > > > > > >> On Sat, Sep 12, 2020 at 1:09 PM Prabir Shrestha < > > > >> vim-dev-git...@256bit.org> wrote: > > > >> > > > >>> +1 for adding fuzzy match. > > > >>> > > > >>> A bit late to this. But few questions. > > > >>

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-13 Fir de Conversatie Yegappan Lakshmanan
Hi Bram, On Sun, Sep 13, 2020 at 3:44 AM Bram Moolenaar wrote: > > > >> On Sat, Sep 12, 2020 at 1:09 PM Prabir Shrestha < > > >> vim-dev-git...@256bit.org> wrote: > > >> > > >>> +1 for adding fuzzy match. > > >>> > > >>> A bit late to this. But few questions. > > >>> > > >>> How do we use matchf

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-13 Fir de Conversatie Bram Moolenaar
> >> On Sat, Sep 12, 2020 at 1:09 PM Prabir Shrestha < > >> vim-dev-git...@256bit.org> 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. > >>> Primary reason for this is LS

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-12 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sat, Sep 12, 2020 at 10:46 PM Prabir Shrestha wrote: > Great perf improvements. Would love to see the PR with updated doc for > this. > > > Created PR #6947 for this change. Thinking about this change some more, I am wondering whether we should support only the key argument for the list

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-12 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sat, Sep 12, 2020 at 9:24 PM Prabir Shrestha wrote: > Was there perf improvements for dictionary when there was million items > when using key as string instead of callback? curious if 5.5 seconds went > down to 1 sec. > > > Yes. It did go down to 1.1 second with the dictionary key as the

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-12 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sat, Sep 12, 2020 at 6:58 PM Prabir Shrestha wrote: > what happens if you support dict but instead of callback also support > string key. For simple we could use string key and for complex objects > lambda could be used. > > > The updated diff with the support for specifying either a call

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-12 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sat, Sep 12, 2020 at 3:54 PM Yegappan Lakshmanan wrote: > >> On Sat, Sep 12, 2020 at 1:09 PM Prabir Shrestha < >> vim-dev-git...@256bit.org> wrote: >> >>> +1 for adding fuzzy match. >>> >>> A bit late to this. But few questions. >>> >>> How do we use matchfuzzy for a list of dictionary in

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-12 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sat, Sep 12, 2020 at 1:42 PM Yegappan Lakshmanan wrote: > Hi, > > On Sat, Sep 12, 2020 at 1:09 PM Prabir Shrestha > 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. >> Primary reas

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-12 Fir de Conversatie Bram Moolenaar
Yegappan wrote: > On Sat, Sep 12, 2020 at 1:09 PM Prabir Shrestha > 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. Primary > > reason for this is LSP (language server protocol) ma

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-12 Fir de Conversatie Yegappan Lakshmanan
Hi, On Sat, Sep 12, 2020 at 1:09 PM Prabir Shrestha 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. Primary > reason for this is LSP (language server protocol) makes heavy use of > user_data. Ca

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-11 Fir de Conversatie Yegappan Lakshmanan
Hi, On Fri, Sep 11, 2020 at 5:54 AM Bram Moolenaar wrote: > A few practical usage examples would help. > > > To demonstrate the use of the new matchfuzzy() function, I have created a file selector plugin: https://github.com/yegappan/fileselect This plugin will allow you to select a file from t

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-11 Fir de Conversatie Yegappan Lakshmanan
Hi Christian, On Fri, Sep 11, 2020 at 10:39 AM Christian Brabandt < vim-dev-git...@256bit.org> wrote: > Just some minor comments: > > BTW, should we call this function matchfuzzy() or fuzzymatch()? > > matchfuzzy() mostly because it groups with the other match functions or > alternatively searchf

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-11 Fir de Conversatie Bram Moolenaar
Yegappan wrote: > BTW, should we call this function matchfuzzy() or fuzzymatch()? > Any preferences? matchfuzzy() works best. When sorting the match*() functions are together. In the past we have not put the most important property first, which causes related methods to be scattered. So getm

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-11 Fir de Conversatie Yegappan Lakshmanan
Hi, On Fri, Sep 11, 2020 at 9:07 AM Dominique Pellé wrote: > *@dpelle* commented on this pull request. > -- > > In runtime/doc/eval.txt > : > > > @@ -7307,6 +7308,22 @@ matchend({expr}, {pat} [, {start} [, {c

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-11 Fir de Conversatie Yegappan Lakshmanan
Hi, On Fri, Sep 11, 2020 at 7:09 AM lacygoill wrote: > I'm wondering if for the method it should pass the list (as it is now) or > the string to match? > > I think it should pass the list. The question is not so much which one > would vary, but which one we would get via the output of another fu

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-11 Fir de Conversatie Yegappan Lakshmanan
Hi Bram, On Fri, Sep 11, 2020 at 5:55 AM Bram Moolenaar wrote: > Oh, and the implementation fits better in search.c than in evalfunc.c > (which is already very long) > > > I will move the new functions to search.c BTW, should we call this function matchfuzzy() or fuzzymatch()? Any preferences?

Re: [vim/vim] Add the matchfuzzy() function (#6932)

2020-09-11 Fir de Conversatie Yegappan Lakshmanan
Hi Bram, On Fri, Sep 11, 2020 at 5:54 AM Bram Moolenaar wrote: > Thanks. A few minor comments. > The example should mention what the result is. > I have updated the doc with the output. > I'm wondering if for the method it should pass the list (as it is now) or > the string to match? > Which