Jelajahi Sumber

dev: automated commit - 2025-10-12 17:49:26

Mariano Z. 3 bulan lalu
induk
melakukan
332c6aa6d6
4 mengubah file dengan 80 tambahan dan 26 penghapusan
  1. 4 4
      lazy-lock.json
  2. 3 0
      lua/config/remap.lua
  3. 73 0
      lua/plugins/grug-far.lua
  4. 0 22
      lua/plugins/spectre.lua

+ 4 - 4
lazy-lock.json

@@ -12,6 +12,7 @@
   "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
   "gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" },
   "go.nvim": { "branch": "master", "commit": "db20146ef63322949af69b0955f80ee7d98145bd" },
+  "grug-far.nvim": { "branch": "main", "commit": "2e991081c0e653e151fc9e659514d7c2fc31d22a" },
   "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
   "lazydev.nvim": { "branch": "main", "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" },
   "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
@@ -25,8 +26,7 @@
   "nvim-dbee": { "branch": "master", "commit": "dda517694889a5d238d7aa407403984da9f80cc0" },
   "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
   "nvim-lint": { "branch": "master", "commit": "9da1fb942dd0668d5182f9c8dee801b9c190e2bb" },
-  "nvim-lspconfig": { "branch": "master", "commit": "cc2f5f2fa28d240574808e78847978ed6ef20d2a" },
-  "nvim-spectre": { "branch": "master", "commit": "72f56f7585903cd7bf92c665351aa585e150af0f" },
+  "nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" },
   "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
   "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
   "nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" },
@@ -37,8 +37,8 @@
   "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
   "quicker.nvim": { "branch": "master", "commit": "12a2291869a326424b1cbee937f4f80334433012" },
   "render-markdown.nvim": { "branch": "main", "commit": "d53856423be5ef3c267d26ee261b0981b372f718" },
-  "schemastore.nvim": { "branch": "main", "commit": "0a900e539511a4461701f241278626ce6ec8d331" },
-  "snacks.nvim": { "branch": "main", "commit": "dae80fb393f712bd7352a20f9185f5e16b69f20f" },
+  "schemastore.nvim": { "branch": "main", "commit": "155d57353fbf0f9b0b8b7cdd7f8a7ee44bb7cd69" },
+  "snacks.nvim": { "branch": "main", "commit": "b8d838d8be274c8eecced4306cca15378cde9830" },
   "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" },
   "todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" },
   "typst-preview.nvim": { "branch": "master", "commit": "dea4525d5420b7c32eebda7de15a6beb9d6574fa" },

+ 3 - 0
lua/config/remap.lua

@@ -88,5 +88,8 @@ nmap("qk", "<cmd>cprev<cr>", { desc = "Previous quickfix item" })
 
 nmap("<Esc>", "<cmd>nohlsearch<CR>", { desc = "Clear search highlights" })
 
+-- Restore 's' key functionality (Mini.surround overrides it by default)
+nmap("s", "cl", { desc = "Delete character and enter insert mode" })
+
 -- Launch lazygit in a new tmux pane, exits when done
 nmap("<leader>lg", "<cmd>!tmux new-window -c " .. vim.fn.getcwd() .. " -- lazygit <CR><CR>", { desc = "LazyGit" })

+ 73 - 0
lua/plugins/grug-far.lua

@@ -0,0 +1,73 @@
+local M = {
+  "MagicDuck/grug-far.nvim",
+  cmd = "GrugFar",
+  keys = {
+    { "<leader>S", "<cmd>GrugFar<CR>", desc = "GrugFar: Find and Replace" },
+  },
+}
+
+M.config = function()
+  require("grug-far").setup({
+    -- Basic configuration
+    minSearchLength = 2,
+    debounceMs = 300,
+
+    -- UI configuration
+    ui = {
+      border = "rounded",
+      size = {
+        width = 0.8,
+        height = 0.8,
+      },
+    },
+
+    -- Search configuration
+    search = {
+      engines = { "ripgrep", "astgrep", "astgrep-rules" },
+      defaultEngine = "ripgrep",
+    },
+
+    -- History configuration - simplified to avoid the autoSave bug
+    history = {
+      enabled = true,
+      maxEntries = 50,
+    },
+
+    -- Result configuration
+    resultLocation = {
+      showNumberLabel = true,
+    },
+  })
+
+  -- Additional keybindings for enhanced functionality
+  vim.api.nvim_create_autocmd("FileType", {
+    group = vim.api.nvim_create_augroup("grug-far-custom-keybinds", { clear = true }),
+    pattern = { "grug-far" },
+    callback = function()
+      -- Toggle --fixed-strings flag
+      vim.keymap.set("n", "<localleader>w", function()
+        local state = unpack(require("grug-far").get_instance(0):toggle_flags({ "--fixed-strings" }))
+        vim.notify("grug-far: toggled --fixed-strings " .. (state and "ON" or "OFF"))
+      end, { buffer = true, desc = "Toggle fixed strings" })
+
+      -- Open result location and close grug-far
+      vim.keymap.set("n", "<C-enter>", function()
+        require("grug-far").get_instance(0):open_location()
+        require("grug-far").get_instance(0):close()
+      end, { buffer = true, desc = "Open location and close" })
+
+      -- Jump back to first input
+      vim.keymap.set("n", "<left>", function()
+        require("grug-far").get_instance(0):goto_first_input()
+      end, { buffer = true, desc = "Jump to first input" })
+
+      -- Toggle multiline mode
+      vim.keymap.set("n", "<localleader>m", function()
+        local state = unpack(require("grug-far").get_instance(0):toggle_flags({ "--multiline" }))
+        vim.notify("grug-far: toggled --multiline " .. (state and "ON" or "OFF"))
+      end, { buffer = true, desc = "Toggle multiline mode" })
+    end,
+  })
+end
+
+return M

+ 0 - 22
lua/plugins/spectre.lua

@@ -1,22 +0,0 @@
-local M = {
-  "nvim-pack/nvim-spectre",
-}
-
-M.config = function()
-  require("spectre").setup()
-
-  nmap("<leader>S", '<cmd>lua require("spectre").toggle()<CR>', {
-    desc = "Toggle Spectre",
-  })
-  nmap("<leader>sw", '<cmd>lua require("spectre").open_visual({select_word=true})<CR>', {
-    desc = "[Spectre] Search current word",
-  })
-  nmap("<leader>sw", '<esc><cmd>lua require("spectre").open_visual()<CR>', {
-    desc = "[Spectre] Search current word",
-  })
-  nmap("<leader>sp", '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', {
-    desc = "[Spectre] Search on current file",
-  })
-end
-
-return M