Shougo / unite.vim

:dragon: Unite and create user interfaces
http://www.vim.org/scripts/script.php?script_id=3396
Other
2.85k stars 225 forks source link

matcher_fuzzy should prioritize file name matching #495

Closed dlee closed 10 years ago

dlee commented 10 years ago

When using matcher_fuzzy and sorter_rank, I think all the most relevant results end up at the bottom of the list.

I tend to type in file names for searching, but unite.vim prioritizes matches where the directories match the names instead of the files.

Is there a way to reverse this?

My .vimrc has these lines:

call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#custom#source('file_mru', 'matchers', ['matcher_project_files', 'matcher_fuzzy'])
Shougo commented 10 years ago

You must use sorter_rank.

My .vimrc has these lines:

Where is sorter_rank?

I tend to type in file names for searching, but unite.vim prioritizes matches where the directories match the names instead of the files.

Plese show me the minimal .vimrc and the reproduceable ways from Vim starting. I cannot reproduce it.

dlee commented 10 years ago

Oops, I have this line as well:

call unite#custom#source('buffer,file,file_mru,file_rec,file_rec/async', 'sorters', 'sorter_rank')
dlee commented 10 years ago

A common use case is when I have the following files among hundreds:

Typing he reduces the file list to the above three, but in this order:

My goal is to get to hello_there.vim, so I continue the matching by typing v to differentiate between hello_there.js and hello_there.vim.

However, now the list has changed so that the he portion matches the directory name with higher priority:

The only way I can get hello_there.vim to come on top is by typing out the whole name. Instead, I would like hev to prioritize hello_there.vim over hello_there/hi.vim.

Shougo commented 10 years ago

OK. But I don't want to change it. Pull request is well come.

You can change sorter_rank code. I have not much time.

https://github.com/Shougo/unite.vim/blob/master/autoload/unite/filters/sorter_rank.vim