mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
feat(editor): replace nvim-spectre with grug-far.nvim (#4099)
## Description I'm considering to replace [nvim-spectre](https://github.com/nvim-pack/nvim-spectre) with [grug-far.nvim](https://github.com/MagicDuck/grug-far.nvim). It has a better ui and I like the workflow better. I won't merge this right away. I'm mostly looking for feedback on whether this would be a good thing and whether the defaults option I've added seem ok. ## Related Issue(s) <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> --> ## Screenshots  ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
This commit is contained in:
parent
eed91a3e4c
commit
0d561a3226
4 changed files with 29 additions and 6 deletions
3
NEWS.md
3
NEWS.md
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
## 12.x
|
## 12.x
|
||||||
|
|
||||||
|
- [nvim-spectre](https://github.com/nvim-pack/nvim-spectre) has been removed in favor of [grug-far.nvim](https://github.com/MagicDuck/grug-far.nvim).
|
||||||
|
**grug-far.nvim** has a great UI and feels more intuitive to use.
|
||||||
|
|
||||||
- This **news** is now also available on the website at [https://www.lazyvim.org/news](https://www.lazyvim.org/news)
|
- This **news** is now also available on the website at [https://www.lazyvim.org/news](https://www.lazyvim.org/news)
|
||||||
|
|
||||||
- **prettier** extra now works for all prettier supported filetypes
|
- **prettier** extra now works for all prettier supported filetypes
|
||||||
|
|
|
@ -55,6 +55,7 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||||
group = augroup("close_with_q"),
|
group = augroup("close_with_q"),
|
||||||
pattern = {
|
pattern = {
|
||||||
"PlenaryTestPopup",
|
"PlenaryTestPopup",
|
||||||
|
"grug-far",
|
||||||
"help",
|
"help",
|
||||||
"lspinfo",
|
"lspinfo",
|
||||||
"notify",
|
"notify",
|
||||||
|
|
|
@ -128,13 +128,25 @@ return {
|
||||||
|
|
||||||
-- search/replace in multiple files
|
-- search/replace in multiple files
|
||||||
{
|
{
|
||||||
"nvim-pack/nvim-spectre",
|
"MagicDuck/grug-far.nvim",
|
||||||
build = false,
|
opts = { headerMaxWidth = 80 },
|
||||||
cmd = "Spectre",
|
cmd = "GrugFar",
|
||||||
opts = { open_cmd = "noswapfile vnew" },
|
|
||||||
-- stylua: ignore
|
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>sr", function() require("spectre").open() end, desc = "Replace in Files (Spectre)" },
|
{
|
||||||
|
"<leader>sr",
|
||||||
|
function()
|
||||||
|
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",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,13 @@ return {
|
||||||
end, { expr = true })
|
end, { expr = true })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "grug-far",
|
||||||
|
callback = function()
|
||||||
|
vim.b.minianimate_disable = true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
LazyVim.toggle.map("<leader>ua", {
|
LazyVim.toggle.map("<leader>ua", {
|
||||||
name = "Mini Animate",
|
name = "Mini Animate",
|
||||||
get = function()
|
get = function()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue