zimfw / fzf

Configures fzf for faster fetching of files and directories names.
MIT License
10 stars 5 forks source link

Feature/Make compatible with fzf completion #1

Closed ethan605 closed 3 years ago

ethan605 commented 3 years ago

Problem

After integrating FZF's completion plugin, triggering completion for directories with ** <TAB> gave an error:

$ cd path/to/dir/** <TAB>
[fd error]: The search pattern 'path/to/dir' contains a path-separation character ('/') and will not lead to any search results.

If you want to search for all files inside the 'path/to/dir' directory, use a match-all pattern:

  fd . 'path/to/dir'

Instead, if you want your pattern to match the full file path, use:

  fd --full-path 'path/to/dir'

This also applied to files completion, e.g:

$ vim /path/to/file/** <TAB>

Solution

Add match-all pattern to fd command in _fzf_compgen_path and _fzf_compgen_dir functions

ericbn commented 3 years ago

Hi @ethan605, good catch! Thanks for the contribution.