Closed alex35mil closed 2 weeks ago
hi @alex35mil , you can add those types of keybinds easily like so:
vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('grug-far-keymap', { clear = true }),
pattern = { 'grug-far' },
callback = function()
-- jump back to search input by hitting left arrow in normal mode:
vim.keymap.set('n', '<left>', function()
vim.api.nvim_win_set_cursor(vim.fn.bufwinid(0), { 3, 0 })
end, { buffer = true })
-- ... whatever other keybinds you like :)
end,
})
The only other "navigation keymaps" are already configurable (openNextLocation / openPrevLocation
):
https://github.com/MagicDuck/grug-far.nvim/blob/b7c2b28e49d55ff71cd9bb3ad19a2021316510d8/lua/grug-far/opts.lua#L166
Also, openPrevLocation
and gotoLocation
accept number counts if you like that kind of nav, but there is nothing qwerty specific 😄
note: if you use the latest, you will have to -1 the line number, eg:
vim.api.nvim_win_set_cursor(vim.fn.bufwinid(0), { 2, 0 })
due to a recent change to support https://github.com/MagicDuck/grug-far.nvim/issues/285
Works for me, thanks!
Is there a way to quickly jump back to Search input (or other input fields) from search results?
On other note, I'm on Dvorak and I don't use
hjkl
at all, so navigation is a bit convoluted. It would be great to expose api to configure navigation keymaps.