mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-09 04:15:02 +02:00
feat: use selection when in visual mode
This commit is contained in:
parent
68cf175176
commit
5adec47431
1 changed files with 8 additions and 5 deletions
|
@ -135,13 +135,16 @@ return {
|
||||||
{
|
{
|
||||||
"<leader>sr",
|
"<leader>sr",
|
||||||
function()
|
function()
|
||||||
require("grug-far").grug_far({
|
local is_visual = vim.fn.mode():lower():find("v")
|
||||||
prefills = {
|
if is_visual then -- needed to make visual selection work
|
||||||
search = vim.fn.expand("<cword>"),
|
vim.cmd([[normal! v]])
|
||||||
filesFilter = "*." .. vim.fn.expand("%:e"),
|
end
|
||||||
},
|
local grug = require("grug-far");
|
||||||
|
(is_visual and grug.with_visual_selection or grug.grug_far)({
|
||||||
|
prefills = { filesFilter = "*." .. vim.fn.expand("%:e") },
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
mode = { "n", "v" },
|
||||||
desc = "Search and Replace",
|
desc = "Search and Replace",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue