Closed ahmedelgabri closed 3 years ago
Added in this commit:
https://github.com/camspiers/snap/commit/e52ebce05cb25e1ea8b0b2feaee0367fc301ffd9
There is now a help producer, a help previewer and a help selector.
I hope it all makes sense, remember you can do anything you want in your own custom producers, previews, selectors etc. You don't need to use ripgrep etc.
local fzf = snap.get'consumer.fzf'
snap.register.map({"n"}, {"<Leader>fh"}, function ()
snap.run {
prompt = "Help>",
producer = fzf(snap.get'producer.vim.help'),
reverse = true,
select = snap.get'select.help'.select,
views = {snap.get'preview.help'}
}
end)
Tagging @akinsho too
I hope it all makes sense, remember you can do anything you want in your own custom producers, previews, selectors etc. You don't need to use ripgrep etc.
I know, I tried that but was faced with #13 (or maybe I was doing something wrong)
But thanks for this, will give it a try.
@camspiers just tried it, works great! thanks 👍🏼
No problem!
And thanks for the idea btw :)
@camspiers thanks for adding this (and tagging me) I've definitely been wanting/missing this functionality.
One quick question which I couldn't tell if it was possible or not was whether it's possible to show the result in a floating window like the other types of pickers? (based on just copying the snippet you posted above), the match is shown in a vertical split instead.
It shouldn't be displaying in a split if you use views = {snap.get'preview.help'}
at least it doesn't for me.
Do you mean if you select the match?
Ah, it's because my ftplugin file is being read, and it contains
autocmd! BufWinEnter <buffer> wincmd L | vertical resize 80
🤔 not sure how to work around this short of removing the line. I think the way the buffers are read triggers autocommands like filetypes etc. which somehow telescope does without
Wait, that's not a feature? 😆 I actually liked that split for the help & thought it was built like this. turns out I also had an ftplugin for help with wincmd L
@camspiers, reluctant to add even more to your plate but just thought it was worth mentioning that although using noautocmd
prevents triggering the ftplugin
files it also means that syntax highlighting isn't enabled for those buffers.
It's not a huge deal and I think it's a bit of a thorny issue to resolve anyway but just putting it out there.
Syntax highlighting for the help files should be easy to turn on manually in the preview. I welcome a PR but otherwise I can likely get to it tomorrow or the next day.
Something like
:Helptags
fromfzf.vim
ortelescope.help_tags()
, I'm still a bit struggling to get any custom finder implementation to work for me, especially with issues like #13 but for this one, I don't even know if that's possible. For example, there is no CWD in that case to pass toproducer.ripgrep.general