Skip to content

Commit

Permalink
Try out grug-far for search and replace
Browse files Browse the repository at this point in the history
  • Loading branch information
notahat committed Jan 5, 2025
1 parent ccb31f2 commit 1df80a1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
9 changes: 5 additions & 4 deletions config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{
"blink.cmp": { "branch": "main", "commit": "e3b7cb4a1094377c3093a021300de123d9fc60d3" },
"blink.cmp": { "branch": "main", "commit": "51fb932f63af0d6722ad6e31c8e931a5a684bd25" },
"dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" },
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
"grug-far.nvim": { "branch": "main", "commit": "08f32182335754abf461dfb77b2c4e24bfe4d614" },
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
"lsp-progress.nvim": { "branch": "main", "commit": "f3df1df8f5ea33d082db047b5d2d2b83cc01cd8a" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"nightfox.nvim": { "branch": "main", "commit": "595ffb8f291fc4a9bef3201a28b7c0379a41cdee" },
"noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" },
"none-ls.nvim": { "branch": "main", "commit": "00421b9dc7a4d132ca74cfb4c7e8030d05d6fd0b" },
"none-ls.nvim": { "branch": "main", "commit": "20f5650988cd849e18c7f3d2dce4b0e6a260e126" },
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
"nvim-lightbulb": { "branch": "master", "commit": "3ac0791be37ba9cc7939f1ad90ebc5e75abf4eea" },
"nvim-lspconfig": { "branch": "master", "commit": "f4ed656e876e45cf914d7beb972830561178e232" },
"nvim-notify": { "branch": "master", "commit": "bd9cd51f9ef2f6326fc2bc9931d0718c1794e247" },
"nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" },
"nvim-treesitter": { "branch": "master", "commit": "fae21737be2846a04ae06a41d70b7fc8ad4bf9eb" },
"nvim-treesitter": { "branch": "master", "commit": "57713d079c3c2afcc31f3e0650bf8594a2a296ba" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
"nvim-web-devicons": { "branch": "master", "commit": "5740b7382429d20b6ed0bbdb0694185af9507d44" },
"oil-git-status.nvim": { "branch": "main", "commit": "a7ea816bac0cc3b8b4c3605e2f2b87960be60a05" },
"oil.nvim": { "branch": "master", "commit": "c6a39a69b2df7c10466f150dde0bd23e49c1fba3" },
"oil.nvim": { "branch": "master", "commit": "254bc6635cb3f77e6e9a89155652f368e5535160" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"snacks.nvim": { "branch": "main", "commit": "d312053f78b4fb55523def179ac502438dd93193" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
Expand Down
5 changes: 5 additions & 0 deletions config/nvim/lua/config/key-mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ local function previous_git_hunk()
require("gitsigns").prev_hunk()
end

local function search_and_replace()
require("grug-far").open()
end

-- Tip: Try to have few custom mappings, and use built-in mappings as much as
-- possible. Stick to mostly "<leader>*" mappings, rather than going deeper.

Expand Down Expand Up @@ -86,6 +90,7 @@ vim.keymap.set("n", "<leader>h", telescope_help_tags, { desc = "Help" })
vim.keymap.set("n", "<leader>j", toggle_join, { desc = "Join/split" })
vim.keymap.set("n", "<leader>n", open_notifications, { desc = "Notifications" })
vim.keymap.set("n", "<leader>q", vim.cmd.xall, { desc = "Quit" })
vim.keymap.set("n", "<leader>r", search_and_replace, { desc = "Search and replace" })
vim.keymap.set("n", "<leader>w", vim.cmd.wall, { desc = "Write all" })
vim.keymap.set("n", "<leader>x", delete_buffer, { desc = "Delete buffer" })
vim.keymap.set("n", "<leader>/", telescope_live_grep, { desc = "Live grep" })
Expand Down
1 change: 1 addition & 0 deletions config/nvim/lua/config/options.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- Use space as the leader key.
vim.g.mapleader = " "
vim.g.localleader = "\\"

-- Show relative line numbers, but display the actual line
-- number on the current line, and highlight it.
Expand Down
6 changes: 6 additions & 0 deletions config/nvim/lua/plugins/grug-far.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Search and replace using ripgrep.
return {
"MagicDuck/grug-far.nvim",
lazy = true,
opts = {},
}

0 comments on commit 1df80a1

Please sign in to comment.