mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
nvim: grep undercursor
This commit is contained in:
parent
5b8f5dbeb2
commit
dad88aa92f
1 changed files with 8 additions and 0 deletions
|
|
@ -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("<cword>"),
|
||||
initial_mode = "normal",
|
||||
}
|
||||
end
|
||||
|
||||
-- Better than builtin /
|
||||
vim.keymap.set("n", "/", builtin["current_buffer_fuzzy_find"])
|
||||
vim.keymap.set("n", "<leader>w", find_undercursor_in_buffer)
|
||||
vim.keymap.set("n", "<leader>W", grep_undercursor)
|
||||
|
||||
-- Use / as prefix to avoid collision in bindings
|
||||
vim.keymap.set("n", "<leader>/f", builtin["find_files"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue