-
-
Notifications
You must be signed in to change notification settings - Fork 833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: quickfixhistory should choose existing history #3273
Comments
Do you have an proposal on how to achieve this? I'm far from a quickfix list guru. Seems to me like after selecting a quickfix list as an entry in |
The easiest way is to just provide a separate keymap that selects a quickfix history directly based on the first display's selected row. Then no custom That said I think a custom local index = _get_the_selected_quickfix_index_row_from_telescope()
local selected_entries = _get_the_selected_entries_telescope()
if not selected_entries or vim.tbl_isempty(selected_entries) then
_select_the_quickfix_by_index(index)
return
end
local all_entries = vim.fn.getqflist({id=index, all=0})
local filtered_entries = vim.iter(all_entries.items):map(
function(value) return _remove_any_excess_if_needed(value) end
):totable()
if not vim.deep_equal(selected_entries, filtered_entries) then
-- Basically the current logic that nvim-telescope is doing goes here
_create_new_quickfix_with_selected_entries(selected_entries)
else
-- NOTE: This is rare but if they select every entry, just select the quickfix index
_select_the_quickfix_by_index(index)
end I haven't looked at the Telescope implementation so this code is a bit pseudo but something along these lines seems reasonable. What do you think? |
That might still require some rework of the existing picker implementation. |
Silly me, turns out it actually already has that feature - telescope.nvim/lua/telescope/builtin/__internal.lua Lines 486 to 491 in 5972437
It would be nice if there's a command to "go back" in case I dive into a quickfixhistory and see that I actually want the whole of a quickfix but this is enough. Because sometimes you don't know you want an qf until you see its entries But if you don't dive into the second picker and |
A somewhat related question. Do you also think the sorting of the quickfix list history picker is wrong? For me, the first selected quickfix history item is the oldest quickfix history item. I think it would make much more sense to reverse the sorting order so that the youngest quickfix history item, is the first selected item. |
Is your feature request related to a problem? Please describe.
If I call
:chistory
, it lists 2 entriesIf I call
:Telescope quickfixhistory
and select an entry and pressCtrl-q
, it creates a new quickfix entryTelescope
Ctrl-q
is normally meant to convert the current Telescope entries into a quickfix but for quickfixhistory it'd make more sense for to reuse the quickfix entry instead assuming the user hasn't selected any custom entries to filter by. Or maybe as a different mapping. So even if you select a quickfix list, Vim doesn't create a new one.The quickfix list is a limited resource. You only get 10 entries. So the plugin creating a new entry each time you call
:Telescope quickfixhistory
is pretty inconvenient.Describe the solution you'd like
ctrl-q
selects the quickfix history instead of creating a new quickfix history entry wherever possible.Describe alternatives you've considered
Maybe instead keep
ctrl-q
the same but provide a new mapping which does select the quickfix entry.The text was updated successfully, but these errors were encountered: