Open antoinemadec opened 2 years ago
telescope.sorters should include a preserve_order so the list filtering do not reorder the entries. This is useful for chronological lists (e.g.: git commits). See: sorters.lua
There's two variants here. The opts.tiebreak
(which doesn't do what you want I understand from comment of your PR) and
what comes to mind is https://github.com/nvim-telescope/telescope.nvim/pull/1168#issuecomment-986001845 as a potential interface for something like that similar to your solution. So yeah, we want this, but ideally a bit more generically :)
I hope to have more time in July to get back to something like that. It would be relatively straightforward I hope.
telescope.actions should include selectpreview* so the previews can be open. This is useful for previews generated by a command line (e.g.: git commits).
I personally think that's cool (some use cases come to mind) and should be relatively straightforward, would you be happy to do a PR for that? :) happy to guide to provide references to what to look at. (As a side note, one thing to keep in mind here the actual selection and preview in many cases coincide :)
git_live_grep and git_grep_string could be implemented.
This should be doable via hooking into the vanilla variants which I understand does already work to a large degree? git cwd detection could be a util that is passed to opts.cwd
? Anything else that we could have in core here to facilitate that?
Re select_preview_*
. I've wrote an interface for octo.nvim a long time ago that doesn't clean up the last_preview_bufnr
so you can just open that one
See keep_last_buf
under :help telescope.previewers.new_buffer_previewer
@Conni2461 does your code work when multiple telescope instances are running ? Do you think it could be pushed in telescope ?
On my end, my code does a copy/paste which might not be ideal, but should work with multiple telescope opened at the same time. https://github.com/antoinemadec/telescope-git-browse.nvim/blob/4b67681014898e1d67138e2bf396d82c92ffe2a8/lua/telescope/_extensions/git_browse/actions.lua#L22-L38
multiple telescope instances are running
What are multiple telescope instances? If you are in an telescope instance and try to open a new one, we close the previous one
Do you think it could be pushed in telescope ?
Dont know, usually opening previewers will not work as expected. E.g. file previewers, thats also the reason why you can't focus the previewer. It works great for a specific usecase like octo, where he created really specific buffer content, with custom highlighting, to review prs for example. So to reduce code duplication he asked me if we could not clean up the last previewer.
OK, let me know if you want me to create a PR for something in particular, I'd be happy to help.
Is your feature request related to a problem? Please describe.
git_commits
:git_live_grep
andgit_grep_string
are missing from the builtin functionsDescribe the solution you'd like
telescope.sorters
should include apreserve_order
so the list filtering do not reorder the entries. This is useful for chronological lists (e.g.: git commits). See: sorters.luatelescope.actions
should includeselect_preview_*
so the previews can be open. This is useful for previews generated by a command line (e.g.: git commits). See: actions.luagit_commits
should:telescope.sorters.preserve_order
telescope.actions.select_preview_*
git_live_grep
andgit_grep_string
could be implemented. See: git_browse.luaDescribe alternatives you've considered Create an extension. See: telescope-git-browse.nvim
I understand that what should be in the builtin functions is open to debate. However, I think
preserve_order
andselect_preview_*
could benefit everyone. Thanks for the great plugin :heart: