camspiers/snap

unclear readme

ckoehler opened this issue · 4 comments

Sorry, I am having a hard time understanding how snap.config.file works, opposed to snap.run. I see the snap.run examples, and they make sense. It seems like snap.config.file returns a function that calls snap.run. But if I use snap.config.file, how do I specify select, multiselect, view, etc?

Concretely, I understand this (from the readme):

snap.run {
  producer = snap.get'consumer.fzy'(snap.get'producer.ripgrep.file'),
  select = snap.get'select.file'.select,
  multiselect = snap.get'select.file'.multiselect,
  views = {snap.get'preview.file'}
}

How would I configure ripgrep above to also search hidden, etc, as in this file example?

file {producer = "ripgrep.file", args = {'--hidden', '--iglob', '!.git/*'}}

I.e., how do I combine the two and put them into snap.maps ?

Duh, I think file only handles searches for files. And there are some predefined options, so that all works. If I want grep or something, sounds like I need to do it custom.

tex commented

I have the same issue with documentation. snap.run is understandable, but it executes immediately. How to map it?

tex commented

Ah, answer is there: https://www.reddit.com/r/neovim/comments/nvl2fy/snap_a_nonblocking_finder_system_for_neovim_05/

snap.register.map({"n"}, {"<Leader>f"}, function ()
  snap.run {
    producer = snap.get'consumer.fzf'(snap.get'producer.ripgrep.file'),
    select = snap.get'select.file'.select,
    multiselect = snap.get'select.file'.multiselect,
    views = {snap.get'preview.file'}
  }
end)

It would be nice if this was in the Review.

tex commented

It is in the Readme, but just as a text, and I missed it. Example would be still nice.