Closed simonmandlik closed 2 weeks ago
Thanks for the suggestion!
My first instinct is that it adds too even more complexity to already overcrowded config.mappings
. Implementation-wise this should be pretty straightforward, but will also add documentation and testing burden (both to mappings and underlying exported implementation function).
Also while I do agree that four g{[,]}{n,l}
are the right choice of mapping keys for this, they don't look too ergonomic on a standard QWERTY keyboard.
So my suggestion would be to make mappings manually. With something like this:
local map_nextlast_motion = function(lhs, side, search_method)
local rhs = function()
MiniAi.move_cursor(side, 'a', vim.fn.getcharstr(), { search_method = search_method, n_times = vim.v.count1 })
end
local desc = 'Go to ' .. side .. ' side of ' .. search_method .. ' textobject'
vim.keymap.set({ 'n', 'x', 'o' }, lhs, rhs, { desc = desc })
end
map_nextlast_motion('g[n', 'left', 'next')
map_nextlast_motion('g]n', 'right', 'next')
map_nextlast_motion('g[l', 'left', 'prev')
map_nextlast_motion('g]l', 'right', 'prev')
Closing as not planned.
Contributing guidelines
Module(s)
mini.ai
Description
It would be great if it was possible specify where to jump to with next/last variants, e.g.
g]n)
. This would be especially useful withsearch_method = cover
.