Kakoune: Consider allowing fuzzier matching tuned to file matching

Created on 10 Jan 2017  路  6Comments  路  Source: mawww/kakoune

As far as I understand, right now we have one matcher for everything. This can be inconvenient for matching file paths, for example as described in https://github.com/mawww/config/blob/master/kakrc#L84 .

However the matcher is (at least for me) less satisfactory than (say) what fzf uses for match files. One specific problem that bit me is that fzf helpfully favors matching file names rather than other parts of the path, so for example if you have

foo/bar/baz # this is the file I'm looking for
bar/<tons of files here> # this is an unrelated directory with `baz` in it

fzf fill have foo/bar/baz as the first hit, while currently kak shows all the files in bar/ first. I'm sure there are other tricks that we could copy from fzf, Sublime Text, etc.

There are two options:

  • Create a second matcher tuned for file paths
  • Special-case the normal matcher to have more sophisticated heuristics for things that look like file paths

Most helpful comment

I actually recorded a short video of how I use fzf and Kakoune together should you be interested: https://vimeo.com/200792397

All 6 comments

Other improvements that I think would greatly improve :find:

  • Include open buffers and favor them (basically merge :find and :b)
  • Penalize hidden files and folders
  • Allow caching of the indexes -- find can be quite slow on big codebases on some file systems (e.g. HFS)

Why not use fzf to open files and change buffers?

I lean on fzf a lot in my kakoune workflow. You can see my config for it starting at https://github.com/danr/dotfiles/blob/0df570877463d75e2b291cd270219221075ffc4f/config/kak/kakrc#L471 It's hardcoded to use urxvt and meant to be used with a tiling window manager, but should be easily adapted for tmux or what have you.

I did not realize you could use fzf from within kak! I'll try it out and let you know.

The other thing that would be missing from this is the favoring of the open buffers, but that's probably bearable.

I actually recorded a short video of how I use fzf and Kakoune together should you be interested: https://vimeo.com/200792397

@danr that looks great, I didn't have the time to try it because your commands use urxvt, which I do not have on OSX. I'll try to understand them and adapt them when I have some time.

I believe the answer is that you should use a tool that runs its own matcher optimised for file paths, could we close this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vbauerster picture vbauerster  路  3Comments

alexherbo2 picture alexherbo2  路  4Comments

akkartik picture akkartik  路  3Comments

dpc picture dpc  路  4Comments

Delapouite picture Delapouite  路  4Comments