vis-config
lua scripts to configure vis editor
git clone https://9o.is/git/vis-config.git
commit 29585b2953a762642676379f4be5124f26f21793 parent 413589dcf13802f0078ee986305675f8703d9732 Author: Jul <jul@9o.is> Date: Mon, 26 Jan 2026 00:56:08 -0500 dont get cursor word in normal mode grep search Diffstat:
| M | lib/search.lua | | | 9 | ++++++++- |
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/search.lua b/lib/search.lua @@ -49,7 +49,14 @@ vis:command_register('dfind', function(_, _, win) end, 'Find directories') vis:command_register('grep', function(argv, _, win) - local pattern = #argv == 0 and content(win) or table.concat(argv, ' ') + local pattern + if #argv == 0 and win.selection.anchored then + pattern = content(win) + elseif not #argv == 0 then + pattern = table.concat(argv, ' ') + else + pattern = '.*.' + end pattern = pattern:gsub(M.grep_wrap, '\\'..M.grep_wrap) pattern = string.format('%s%s%s', M.grep_wrap, pattern, M.grep_wrap)