Yggdroot / LeaderF

An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc. on the fly for both vim and neovim.
Apache License 2.0
2.14k stars 178 forks source link

Search results sorted by line number #698

Open NGPONG opened 4 years ago

NGPONG commented 4 years ago

let g:Lf_PreviewResult = { \ 'Rg': 1, \ 'Line': 1 } let g:Lf_HideHelp = 1 let g:Lf_UseCache = 0 let g:Lf_UseVersionControlTool = 0 let g:Lf_IgnoreCurrentBufferName = 1 let g:Lf_ReverseOrder = 0 let g:Lf_CommandMap = {'': [''], '': ['']} let g:Lf_WindowHeight = 0.2 let g:Lf_PreviewHorizontalPosition = 'right' let g:Lf_DefaultMode = 'Fuzzy' "let g:Lf_EmptyQuery = 0 "let g:Lf_ReverseOrder = 1 function! Find_current() let g:Lf_PreviewInPopup = 0 execute 'Leaderf rg --bottom --current-buffer' endfunction function! Find_file() let g:Lf_PreviewInPopup = 1 execute 'Leaderf rg --bottom' endfunction let g:LfNormalMap = { \ "": [ \ ["", "p"] \ ] }

" }



### Describe your question, feature request, or bug.
This is just a simple question about feature, so I eliminated the irrelevant information provided on the issues template.

Is it possible to sort the search results by line number?
是否能够依据当前的搜索结果进行排序?

If so, it would be better to make it so that it sorts downwards from the line number where the current cursor is located.
如果可以,最好可以做成依据当前光标所在行号开始进行向下排序

I went through the documentation and found two settings, such as 'g:Lf_ReverseOrder', but they didn't work as well as I had hoped
我翻阅过了文档,找到诸如这个设置 'g:Lf_ReverseOrder',但是它所起到的效果并不是我所预期的那样

And, I also went through the issues and found a similar one https://github.com/Yggdroot/LeaderF/issues/679 that was closed by because it was not possible to implement. But I found the same fuzzy search feature in the 'CocList line' plugin, and the coc-list search results can be sorted by line number.
并且,我也查找过相关 issuse,并找到一个相似的问题,遗憾的是,他所关闭的理由是因为无法实现.
但是,我在 'CocList line' 中发现了相同的模糊搜索的功能,并且它所反馈出来的结果是能够依照行号进行排序的

It's not really a good idea to compare leaderf and coc when I don't really know how they're implemented, but my intention was just to get a sense of what's going on. Your help will be appreciated. Thankd
Yggdroot commented 4 years ago

What command do you mean? Leaderf line? Yes, it sorts the result according to the fuzzy matching but not line number. No fuzzy matching sort is the sort by line, i.e., just filter the result. Is it what you expect?

NGPONG commented 4 years ago

Thank you for your response, and I'm sorry it's taken so long to respond. I have noticed the regx pattern you are talking about, please forgive me for neglecting to include this feature.

NGPONG commented 3 years ago

我很抱歉重新打开了这个问题,我发现了我遗漏了一点,即: 在 regx 模式下的匹配结果,是否能依据当前光标所在行号开始进行向下排序

NGPONG commented 3 years ago

我很抱歉重新打开了这个问题,我发现了我遗漏了一点,即: 在 regx 模式下的匹配结果,是否能依据当前光标所在行号开始进行向下排序

例如,aaa 匹配串分别在 100 行和 500 行各有一例,假设当前光标所在行为 490 上,那么匹配结果应当把 500 行的结果放在首位,100 行次之

Yggdroot commented 3 years ago

本身就是以行号排序的,只不过是按照从小到大的顺序。

NGPONG commented 3 years ago

本身就是以行号排序的,只不过是按照从小到大的顺序。

感谢您的回复

是的,现在这款插件其实已经非常的完美了,如果硬要在鸡蛋里头挑骨头,还是有一点小小的建议,如果这个排序次序,能够以当前光标所在行为基准进行向下排序那就更好了

Yggdroot commented 3 years ago

不太好做。