From d3da08e86c1f6a6add1b6a52778638b9ec4c3084 Mon Sep 17 00:00:00 2001 From: Georgi Dimitrov Date: Tue, 22 Oct 2024 14:49:10 +0300 Subject: [PATCH] neovim: replace nvim-spectre with grug-far --- nvim/lua/plugins/ui.lua | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/nvim/lua/plugins/ui.lua b/nvim/lua/plugins/ui.lua index ea04d4c..6b6f270 100644 --- a/nvim/lua/plugins/ui.lua +++ b/nvim/lua/plugins/ui.lua @@ -186,11 +186,7 @@ return { end, }, { - 'windwp/nvim-spectre', - dependencies = { - 'nvim-lua/popup.nvim', - 'nvim-lua/plenary.nvim', - }, + 'MagicDuck/grug-far.nvim', init = function() local keymap = require('utils.keymap') keymap.register_group('s', 'Search', {}) @@ -200,21 +196,21 @@ return { { 'sr', function() - require('spectre').open() + require('grug-far').open() end, desc = 'Search in project', }, { 'sw', function() - require('spectre').open_visual({ select_word = true }) + require('grug-far').open({ prefills = { search = vim.fn.expand('') } }) end, desc = 'Search for word under cursor', }, { 'sw', function() - require('spectre').open_visual() + require('grug-far').with_visual_selection() end, desc = 'Search for selection', mode = { 'v', 'x' }, @@ -222,20 +218,21 @@ return { { 'sf', function() - require('spectre').open_file_search() + require('grug-far').open({ prefills = { paths = vim.fn.expand('%') } }) end, desc = 'Search in current file', }, - }, - opts = { - mapping = { - ['send_to_qf'] = { - map = '', - cmd = "lua require('spectre.actions').send_to_qf()", - desc = 'send all item to quickfix', - }, + { + 'sa', + function() + require('grug-far').open({ engine = 'astgrep' }) + end, + desc = 'Search with ast-grep engine', }, }, + config = function(_, opts) + require('grug-far').setup(opts) + end, }, { 'echasnovski/mini.indentscope',