"Ignore current buffer" setting for buffer producer
garymh opened this issue Β· comments
Thought of another feature request π:
The buffers listing command is great, but I have some muscle memory with FZF/Telescope where the buffers list ignores the current buffer you're in. I've been using this as a psuedo <c-^>
. since the next buffer is the most recently used buffer (although that might not be the case in snap).
I've been playing with ways to do this with vim.api.nvim_get_current_buf()
, but I think snap's UI is counting as a buffer which throws off any possible conditionals.
You can access the current buffer using the winnr property that is on the request. Omitting the vim.fn because I'm on my phone:
bufname(winbufnr(request.winnr))
See #27
With:
and:
You can now do arbitrary filtering:
snap.run {
producer = snap.get'consumer.fzy'(
snap.get'consumer.filter'(
function (request, result)
-- return boolean, if true then result is added, otherwise it is filtered
end,
snap.get'producer.vim.buffer'
),
),
select = snap.get'select.file'.select,
multiselect = snap.get'select.file'.multiselect,
views = {snap.get'preview.file'}
}
Awesome! Thank you!!