-
Notifications
You must be signed in to change notification settings - Fork 5
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 request: jump to previous or next entry when the context is expanded #3
Comments
Usually I would use require("quicker").setup({
keys = {
{
"]q",
function()
local items = vim.fn.getqflist()
local lnum = vim.api.nvim_win_get_cursor(0)[1]
for i = lnum + 1, #items do
if items[i].valid == 1 then
vim.api.nvim_win_set_cursor(0, { i, 0 })
return
end
end
end,
},
{
"[q",
function()
local items = vim.fn.getqflist()
local lnum = vim.api.nvim_win_get_cursor(0)[1]
for i = lnum - 1, 1, -1 do
if items[i].valid == 1 then
vim.api.nvim_win_set_cursor(0, { i, 0 })
return
end
end
end,
},
},
}) |
Thanks! That's definitely cleaner than what I came up with. I am well aware of Thanks for help and an awesome plugin! 😁 Edit: if you would like the above solution to wrap around the start and the end of quickfix list, then change it to: require("quicker").setup({
keys = {
{
"]q",
function()
local items = vim.fn.getqflist()
local lnum = vim.api.nvim_win_get_cursor(0)[1]
for i = lnum + 1, #items do
if items[i].valid == 1 then
vim.api.nvim_win_set_cursor(0, { i, 0 })
return
end
end
-- Wrap around the end of quickfix list
for i = 1, lnum do
if items[i].valid == 1 then
vim.api.nvim_win_set_cursor(0, { i, 0 })
return
end
end
end,
},
{
"[q",
function()
local items = vim.fn.getqflist()
local lnum = vim.api.nvim_win_get_cursor(0)[1]
for i = lnum - 1, 1, -1 do
if items[i].valid == 1 then
vim.api.nvim_win_set_cursor(0, { i, 0 })
return
end
end
-- Wrap around the start of quickfix list
for i = #items, lnum, -1 do
if items[i].valid == 1 then
vim.api.nvim_win_set_cursor(0, { i, 0 })
return
end
end
end,
},
},
}) |
Did you check existing requests?
Describe the feature
I think that either a function or a recipe for jumping to the previous or the next entry when the context is expanded would be useful!
Provide background
I came up with these entries for
keys
(<
and>
are the keybinds suggested in the READM). These work, but definitely feel hacky. Perhaps an out-of the box solution would be better?Note: it's deliberately split into two calls, because
vim.cmd.normal("<j>")
stopped atj
when I had the cursor on the last row.What is the significance of this feature?
nice to have
Additional details
No response
The text was updated successfully, but these errors were encountered: