mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-08 11:55:22 +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",
|
||||
function()
|
||||
require("grug-far").grug_far({
|
||||
prefills = {
|
||||
search = vim.fn.expand("<cword>"),
|
||||
filesFilter = "*." .. vim.fn.expand("%:e"),
|
||||
},
|
||||
local is_visual = vim.fn.mode():lower():find("v")
|
||||
if is_visual then -- needed to make visual selection work
|
||||
vim.cmd([[normal! v]])
|
||||
end
|
||||
local grug = require("grug-far");
|
||||
(is_visual and grug.with_visual_selection or grug.grug_far)({
|
||||
prefills = { filesFilter = "*." .. vim.fn.expand("%:e") },
|
||||
})
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Search and Replace",
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue