Script which helps to populate the search command within the selected visual range. See search-range
rfind-2023-10-04_19.27.57.o.mp4
It turned out the plugin is not needed to search in visual select, just just the \%V
atom in the search expression
vim.keymap.set("x", "/", "<Esc>/\\%V")
local rfind = require("rfind")
vim.keymap.set("x", "/", rfind.visual)
vim.keymap.set("n", "<F7>", rfind.visual)
Then press /
in visual mode or F7
in normal mode to search in the last
selected section.
vim.api.nvim_create_user_command(
"RangeFind",
function(opts)
local rfind = require("rfind")
return rfind.range(opts.fargs[1], opts.fargs[2])
end,
{nargs = "*"}
)
Then typing RangeFind 10 50
will start the search between lines 10 and 50 (inclusive).