Skip to content

Commit

Permalink
feat!: use grug-far instead of spectre
Browse files Browse the repository at this point in the history
  • Loading branch information
rafi committed Aug 2, 2024
1 parent 5b0c97c commit daec7d9
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 53 deletions.
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ entire configuration has been rewritten to use [lazy.nvim] and Lua.
* [Plugin: Diffview](#plugin-diffview)
* [Plugin: Telescope](#plugin-telescope)
* [Plugin: Neo-Tree](#plugin-neo-tree)
* [Plugin: Spectre](#plugin-spectre)
* [Plugin: Marks](#plugin-marks)
* [Plugin: Zk](#plugin-zk)

Expand Down Expand Up @@ -477,7 +476,7 @@ _Note_ that 95% of the plugins are **lazy-loaded**.
| [hedyhli/outline.nvim] | Code outline sidebar powered by LSP
| [s1n7ax/nvim-window-picker] | Fancy Window picker
| [dnlhc/glance.nvim] | Pretty window for navigating LSP locations
| [nvim-pack/nvim-spectre] | Find the enemy and replace them with dark power
| [MagicDuck/grug-far.nvim] | Search/replace in multiple files
### Coding Plugins
Expand Down Expand Up @@ -586,7 +585,7 @@ _Note_ that 95% of the plugins are **lazy-loaded**.
[akinsho/toggleterm.nvim]: https://github.com/akinsho/toggleterm.nvim
[s1n7ax/nvim-window-picker]: https://github.com/s1n7ax/nvim-window-picker
[dnlhc/glance.nvim]: https://github.com/dnlhc/glance.nvim
[nvim-pack/nvim-spectre]: https://github.com/nvim-pack/nvim-spectre
[MagicDuck/grug-far.nvim]: https://github.com/MagicDuck/grug-far.nvim
[hrsh7th/nvim-cmp]: https://github.com/hrsh7th/nvim-cmp
[hrsh7th/cmp-nvim-lsp]: https://github.com/hrsh7th/cmp-nvim-lsp
Expand Down Expand Up @@ -1339,15 +1338,6 @@ See [nvim-neo-tree/neo-tree.nvim] for more mappings and usage information.
| <kbd>w</kbd> | 𝐍 | Toggle window width
| <kbd>z</kbd> | 𝐍 | Collapse all nodes
#### Plugin: Spectre
See [nvim-pack/nvim-spectre] for more mappings and usage information.
| Key | Mode | Action
| ----- |:----:| ------------------
| <kbd>Space</kbd>+<kbd>sp</kbd> | 𝐍 | Open Spectre window (search & replace)
| <kbd>Space</kbd>+<kbd>sp</kbd> | 𝐕 | Open Spectre with selection
#### Plugin: Marks
See [chentau/marks.nvim] for more mappings and usage information.
Expand Down
1 change: 1 addition & 0 deletions lua/rafi/config/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ if vim.F.if_nil(vim.g.window_q_mapping, true) then
'checkhealth',
'fugitive',
'fugitiveblame',
'grug-far',
'help',
'httpResult',
'lspinfo',
Expand Down
2 changes: 1 addition & 1 deletion lua/rafi/plugins/coding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts = {
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
disable_filetype = { 'TelescopePrompt', 'grug-far', 'spectre_panel' },
},
keys = {
{
Expand Down
57 changes: 17 additions & 40 deletions lua/rafi/plugins/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -356,49 +356,26 @@ return {
},

-----------------------------------------------------------------------------
-- Find the enemy and replace them with dark power
-- Search/replace in multiple files
{
'nvim-pack/nvim-spectre',
-- stylua: ignore
'MagicDuck/grug-far.nvim',
cmd = 'GrugFar',
opts = { headerMaxWidth = 80 },
keys = {
{ '<Leader>sp', function() require('spectre').toggle() end, desc = 'Spectre', },
{ '<Leader>sp', function() require('spectre').open_visual({ select_word = true }) end, mode = 'x', desc = 'Spectre Word' },
},
opts = {
open_cmd = 'noswapfile vnew',
mapping = {
['toggle_gitignore'] = {
map = 'tg',
cmd = "<cmd>lua require('spectre').change_options('gitignore')<CR>",
desc = 'toggle gitignore',
},
},
find_engine = {
['rg'] = {
cmd = 'rg',
args = {
'--pcre2',
'--color=never',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
'--ignore',
},
options = {
['gitignore'] = {
value = '--no-ignore',
icon = '[G]',
desc = 'gitignore',
{
'<leader>sr',
function()
local grug = require('grug-far')
local ext = vim.bo.buftype == '' and vim.fn.expand('%:e')
grug.grug_far({
transient = true,
prefills = {
filesFilter = ext and ext ~= '' and '*.' .. ext or nil,
},
},
},
},
default = {
find = {
cmd = 'rg',
options = { 'ignore-case', 'hidden', 'gitignore' },
},
})
end,
mode = { 'n', 'v' },
desc = 'Search and Replace',
},
},
},
Expand Down
1 change: 1 addition & 0 deletions lua/rafi/plugins/extras/colorscheme/catppuccin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ return {
dashboard = true,
flash = true,
gitsigns = true,
grug_far = true,
headlines = true,
illuminate = true,
indent_blankline = { enabled = true },
Expand Down
49 changes: 49 additions & 0 deletions lua/rafi/plugins/extras/editor/spectre.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
return {

-- Find the enemy and replace them with dark power
{
'nvim-pack/nvim-spectre',
-- stylua: ignore
keys = {
{ '<Leader>sp', function() require('spectre').toggle() end, desc = 'Spectre', },
{ '<Leader>sp', function() require('spectre').open_visual({ select_word = true }) end, mode = 'x', desc = 'Spectre Word' },
},
opts = {
open_cmd = 'noswapfile vnew',
mapping = {
['toggle_gitignore'] = {
map = 'tg',
cmd = "<cmd>lua require('spectre').change_options('gitignore')<CR>",
desc = 'toggle gitignore',
},
},
find_engine = {
['rg'] = {
cmd = 'rg',
args = {
'--pcre2',
'--color=never',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
'--ignore',
},
options = {
['gitignore'] = {
value = '--no-ignore',
icon = '[G]',
desc = 'gitignore',
},
},
},
},
default = {
find = {
cmd = 'rg',
options = { 'ignore-case', 'hidden', 'gitignore' },
},
},
},
},
}
1 change: 1 addition & 0 deletions lua/rafi/util/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ local plugin_icons = {
['neo-tree-popup'] = { '󰋱', 'Neo-tree' },
Outline = { '' },
quickfix = { '', 'Quickfix List' }, -- 󰎟 
['grug-far'] = { '󰥩 ', 'Grug FAR' },
spectre_panel = { '󰥩 ', 'Spectre' },
TelescopePrompt = { '󰋱', 'Telescope' },
terminal = { '' },
Expand Down

0 comments on commit daec7d9

Please sign in to comment.