liuchengxu / vim-clap

:clap: Modern performant fuzzy picker, tree-sitter highlighting, and more, for both Vim and NeoVim
https://liuchengxu.github.io/vim-clap/
MIT License
2.11k stars 87 forks source link

Clap doesn't find file with partial inputs #16

Closed ChrisAmelia closed 5 years ago

ChrisAmelia commented 5 years ago

Environment:

Describe the bug

When looking for a file LocalInterface with partial characters contained in that name, matches are no found.

To Reproduce

  1. Create the minimal vimrc min.vim:
set nocompatible
set runtimepath^=~/.local/share/nvim/plugged/vim-clap
filetype plugin indent on
syntax on
set hidden
  1. Create file LocalInterface:
touch LocalInterface
  1. Start neovim with command: nvim -u min.vim

  2. Type :Clap files

  3. In Clap prompt window, type loin.

  4. File LocalInterface doesn't appear, instead no matches are found.

Expected behavior

File is found when searching with partial characters; as in FZF.

liuchengxu commented 5 years ago

First of all, vim-clap is not essentially a fuzzy finder, but a more generic filter and dispatcher that works only in vim or neovim. Currently only the substring fuzzy filter is available for sync providers, see README, thus loin won't find what you want, try lo in for now. More fuzzy filter mode will be added, and PR is welcome.

What's more, although one of vim-clap's features is in pure vimscript, I'm not against supporting more fuzzy filter using python or other tools. Anyone interested in adding new fuzzy filters could take a look at https://github.com/liuchengxu/vim-clap/blob/master/autoload/clap/filter.vim.

liuchengxu commented 5 years ago

@L-Vim If using macOS or Linux, you can try https://github.com/liuchengxu/vim-clap/pull/18 for new fuzzy finders support: fzy and fzf. But you have to run the sync provider using source_async, e.g., :Clap files ++externalfilter=fzy +async or :Clap files +async. But it also has some drawbacks, see #17. Any feedback is appreciated.

ChrisAmelia commented 5 years ago

Here is how I tested it.

vim-clap version: bf8effb7c759797e345f57261192cae940110e28 of branch validator-registration-info.

Testing with :Clap files ++externalfilter=fzf +async or :Clap files +async and previous minimal vimrc.

  1. In a directory containing file LocalInterface, no files are displayed:

image

When typing the first letter of LocalInterface, message NO MATCHES FOUND immediately appears.

  1. When testing with a git repo (e.g. my dotfiles repo), no files are displayed at first, like above screenshot. Files only appear after having typed a letter that is contained in the files' name:

image

  1. This is the result of searching for file plugins_settings.vim with input insvim:

image

Now testing with :Clap gfiles ++externalfilter=fzf +async or :Clap gfiles +async, previous minimal vimrc and my dotfiles repo (https://github.com/L-Vim/dotfiles):

  1. When using :Clap gfiles +async (or :Clap gfiles ++externalfilter=fzf +async), no files are displayed at first, but after having typed a letter and deleting it, every file is displayed as expected:

image

  1. This is the result of searching for file plugins_settings.vim with input insvim:

image

liuchengxu commented 5 years ago

For https://github.com/liuchengxu/vim-clap/pull/18/commits/bf8effb7c759797e345f57261192cae940110e28 only Clap files +async and Clap blines +async works, otherwise +async will be ignored. The other providers have not been checked. Furthermore, not all sync providers support async feature, like Clap buffers, it's unworthy.

When you run Clap files +async at the first, the display window is empty, that is expected. But now I think it could be improved via fetch all the items without any filtering.

This is the result of searching for file plugins_settings.vim with input insvim:

I believe that how fzf works, you can try other fuzzy filters if you are unsatisfied with filtered result. What vim-clap did is merely to feed the whole output of sourceand the input to the filter(only fzy, fzf for now) and then display the filtered result.

liuchengxu commented 5 years ago

@L-Vim Please try https://github.com/liuchengxu/vim-clap/pull/18/commits/d88b7014ee50f77071a88714aef284f29d27aa06 . I have improved a lot, now basically everything could be async! Now you could use Clap! to tell vim-clap to try running async, e.g, :Clap! blines. Of source, +async also works, it's equal to :Clap!.