Skip to content
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

feature: Add keymap for :Telescope quickfixhistory #3813

Closed
2 tasks done
osamuaoki opened this issue Jun 26, 2024 · 7 comments
Closed
2 tasks done

feature: Add keymap for :Telescope quickfixhistory #3813

osamuaoki opened this issue Jun 26, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@osamuaoki
Copy link

Did you check the docs?

  • I have read all the LazyVim docs
  • This is not a request for a new or existing extra (see above)

Is your feature request related to a problem? Please describe.

Although we can perform down-selection of quickfix list with <C-q> or <M-q>, currently it is a bit awkward to manage quickfix history generated by such actions.

This is because, LazyVim doesn't define keymap for existing :Telescope quickfixhistory while :Telescope quickfix and :Telescope loclist are already assigned to <leader>sq and <leader>sl.

For consistency and ease of use, it will be nice to set all Quickfix related key maps under <leader>x as:

  • :Telescope quickfixhistory (add: <leader>xh),
  • :Telescope quickfix (change: <leader>xt)
  • :Telescope loclist (change: <leader>xT)

Note: <leader>xq, <leader>xQ, <leader>xl, <leader>xL are already taken


Describe the solution you'd like

I have following in my local setting. Making these as a part of LazyVim via its lua/keymaps.lua may be good idea.

-- Telescope quickfix / location list can perform down-selection.
-- <tab> / <S-Tab> to mark
-- <M-q> / <C-q> to down-select list to quickfix (marked / unmarked)
map("n", "<leader>xt", "<cmd>Telescope quickfix<cr>", { desc = "Quickfix List (Telescope)" }) -- same as <leader>sq
map("n", "<leader>xT", "<cmd>Telescope loclist<cr>", { desc = "Location List (Telescope)" })   -- same as <leader>sl
map("n", "<leader>xh", "<cmd>Telescope quickfixhistory<cr>", { desc = "Quickfix History (Telescope)" })
map("n", "<leader>xc", vim.cmd.cclose,{ desc = "Close Quickfix List" })
map("n", "<leader>xC", vim.cmd.lclose, { desc = "Close Location List" })

Describe alternatives you've considered

I also thought about changing <leader>xq and <leader>xl as toggling one to avoid creating separate :cclose / :lclose bindings.

Additional context

Use of noice.nvim is making it more difficult to use :message to check :chistory. Adding above makes this non-issue.

This feature also allow us to avoid using :colder / :cnewer which are error prone.

@osamuaoki osamuaoki added the enhancement New feature or request label Jun 26, 2024
@dpetka2001
Copy link
Contributor

dpetka2001 commented Jun 26, 2024

I believe the mappings for Telescope should go under keys in Telescope spec instead of keymaps.lua, because there is also fzf-lua alternative (that quite a few users use), in order for the mappings to take effect only if Telescope is enabled. Also <leader>xt/T are used currently by todo-comments to open in Trouble, so you might want to choose different ones or just leave the defaults as is.

@osamuaoki
Copy link
Author

I see and I understand. What do you suggest as good choices?

@dpetka2001
Copy link
Contributor

No idea. I don't use Telescope. I've switched to fzf-lua. Just make a PR that adds this keymap under Telescope keys and leave the rest of default keymaps as is. <leader>xh sounds a good choice like you already have. The toggle mapping that you suggested has been discussed in another issue #190 without success. So, just go for the Telescope quickfixhistory mapping if you like.

@osamuaoki
Copy link
Author

I send PR with the narrow scope as suggested.

Come to think of, as for #190, I was actually using ZZ which also worked. So no need.

@osamuaoki
Copy link
Author

For telescope.lua line 126, above mentioned patch added there is good enough.

But what about fzf.lua line 233? Do I need to add similar patch with s/Telescope/FzfLua/ twist ?

I am not quite sure about how these fit into the development road map of LazyVim.

@dpetka2001
Copy link
Contributor

I believe in fzf-lua the corresponding command is FzfLua quickfix_stack, but I don't use it that much. Just leave it be. It's just one keymap and users can add it to their personal configuration if they really want to. Same goes for the Telescope mapping in my personal opinion as just a simple user, but the maintainer has the final say.

@osamuaoki
Copy link
Author

Yah, I found up myself, too. It uses similar but updated internal call. (I updated PR and switched to use fzf-lua here.)

  • If one use quickfix primarily for error fix jump only, maybe quickfix history/stack is not so useful.
  • If one use it with :vim ... with :cdo and uses its existing down-selection UI, this history/stack management is very handy.

Considering these are upstream documented UI functionality of both telescope and fzf-lua in their README, it is not a bad idea to support them. But like you said, its up to the maintainer.

(We can always add them to our keymaps.lua)

@folke folke linked a pull request Jun 29, 2024 that will close this issue
1 task
@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants