From dad88aa92f7be609c72d0a7629bd0883c8c9f651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 8 Jul 2025 14:22:52 +0200 Subject: [PATCH] nvim: grep undercursor --- .config/nvim/after/plugin/telescope.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.config/nvim/after/plugin/telescope.lua b/.config/nvim/after/plugin/telescope.lua index 948c0b5d..de8a2f80 100644 --- a/.config/nvim/after/plugin/telescope.lua +++ b/.config/nvim/after/plugin/telescope.lua @@ -70,10 +70,18 @@ local function find_undercursor_in_buffer() initial_mode = "normal", } end +local function grep_undercursor() + builtin["live_grep"] { + layout_config = { height = 0.8 }, -- Already have word, no need to think + default_text = vim.fn.expand(""), + initial_mode = "normal", + } +end -- Better than builtin / vim.keymap.set("n", "/", builtin["current_buffer_fuzzy_find"]) vim.keymap.set("n", "w", find_undercursor_in_buffer) +vim.keymap.set("n", "W", grep_undercursor) -- Use / as prefix to avoid collision in bindings vim.keymap.set("n", "/f", builtin["find_files"])