Explorar o código

dev: automated commit - 2025-12-28 02:06:54

Mariano Z. hai 1 mes
pai
achega
ad855d7a96
Modificáronse 4 ficheiros con 96 adicións e 234 borrados
  1. 6 7
      lazy-lock.json
  2. 0 81
      lua/plugins/fzf.lua
  3. 0 143
      lua/plugins/git.lua
  4. 90 3
      lua/plugins/qol.lua

+ 6 - 7
lazy-lock.json

@@ -8,11 +8,10 @@
   "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
   "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
   "fzf-lua": { "branch": "main", "commit": "b1d2b0dc146cb9260209da4d7ab754adb0a2653d" },
-  "git-worktree.nvim": { "branch": "main", "commit": "3ad8c17a3d178ac19be925284389c14114638ebb" },
   "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
-  "gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
+  "gitsigns.nvim": { "branch": "main", "commit": "bf77caa5da671f5bab16e4792711d5aa288e8db0" },
   "go.nvim": { "branch": "master", "commit": "41a18f0c05534c375bafec7ed05cdb409c4abcc6" },
-  "grug-far.nvim": { "branch": "main", "commit": "bc589a1ba340a00ae40bf1436401eac5b1454687" },
+  "grug-far.nvim": { "branch": "main", "commit": "74eef260e1142264ab994fb9c88e4f420e9486d7" },
   "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
   "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
   "mini.ai": { "branch": "main", "commit": "bfb26d9072670c3aaefab0f53024b2f3729c8083" },
@@ -23,19 +22,19 @@
   "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
   "nvim-dbee": { "branch": "master", "commit": "dda517694889a5d238d7aa407403984da9f80cc0" },
   "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
-  "nvim-lspconfig": { "branch": "master", "commit": "8973916a3d015d65a8c4614e141f4270a713cf33" },
+  "nvim-lspconfig": { "branch": "master", "commit": "d696e36d5792daf828f8c8e8d4b9aa90c1a10c2a" },
   "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
   "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
   "nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" },
-  "oil.nvim": { "branch": "master", "commit": "756dec855b4811f2d27f067a3aca477f368d99f5" },
+  "oil.nvim": { "branch": "master", "commit": "bbfa7cba85967dc9dbfe0ca486fd4b17084bf846" },
   "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
   "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
   "quicker.nvim": { "branch": "master", "commit": "771437c3e3672dba9233156e1c2e2fc1888a5fff" },
-  "schemastore.nvim": { "branch": "main", "commit": "8b92ea89835b8e5dbc779a675ebb0e5fcb9a1993" },
+  "schemastore.nvim": { "branch": "main", "commit": "60f1b3d1bde39396cdfb1362dd207970ec57e731" },
   "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
   "suda.vim": { "branch": "master", "commit": "c492741b4679b3cdd4d9e34138209784e061d916" },
   "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
-  "typst-preview.nvim": { "branch": "master", "commit": "87d0f3a1beedefe6fdd96422c04c3dceb69d1063" },
+  "typst-preview.nvim": { "branch": "master", "commit": "e123a7ab64e52d836e00dea9251e85b201f38966" },
   "undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" },
   "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
   "vim-hugo": { "branch": "master", "commit": "324fb8c7371d31701349c1192e25a0bdcf9898f8" },

+ 0 - 81
lua/plugins/fzf.lua

@@ -1,81 +0,0 @@
-local M = {
-  "ibhagwan/fzf-lua",
-}
-
-M.config = function()
-  local fzf_lua = require("fzf-lua")
-
-  -- Basic fzf-lua setup
-  fzf_lua.setup({
-    layout = "fzf-vim",
-    keymap = {
-      fzf = {
-        ["CTRL-Q"] = "select-all+accept",
-      },
-    },
-    grep = {
-      fzf_opts = {
-        ["--history"] = vim.fn.stdpath("data") .. "/fzf-lua-grep-history",
-      },
-    },
-  })
-
-  nmap("gd", function()
-    fzf_lua.lsp_definitions({ jump1 = true })
-  end, { desc = "Goto Definition" })
-  nmap("gr", function()
-    fzf_lua.lsp_references({ ignore_current_line = true })
-  end, { desc = "Goto References" })
-  nmap("gi", function()
-    fzf_lua.lsp_implementations({ jump1 = true })
-  end, { desc = "Goto Implementation" })
-  nmap("<leader>D", fzf_lua.lsp_typedefs, { desc = "Type Definition" })
-  nmap("<leader>ca", fzf_lua.lsp_code_actions, { desc = "Code Action" })
-  nmap("<leader>ds", fzf_lua.lsp_document_symbols, { desc = "Document Symbols" })
-  nmap("<leader>ic", fzf_lua.lsp_incoming_calls, { desc = "Incoming Calls" })
-  nmap("<leader>oc", fzf_lua.lsp_outgoing_calls, { desc = "Outgoing Calls" })
-  nmap("<leader>gf", fzf_lua.live_grep, { desc = "Find Live Grep" })
-
-  local exclusions = {
-    "node_modules",
-    ".git",
-    "dist",
-    "build",
-    "coverage",
-    "public",
-  }
-
-  local exclude_opts = ""
-  for _, item in ipairs(exclusions) do
-    exclude_opts = exclude_opts .. " --exclude " .. item
-  end
-
-  nmap("<leader>/", function()
-    fzf_lua.files({
-      cwd_prompt = false,
-      silent = true,
-      fd_opts = "--hidden --no-ignore --type f" .. exclude_opts,
-    })
-  end, { desc = "Find Files" })
-
-  nmap(";", fzf_lua.buffers, { desc = "Find Buffers" })
-  nmap("sb", fzf_lua.grep_curbuf, { desc = "Search Current Buffer" })
-  nmap("gw", fzf_lua.grep_cword, { desc = "Search word under cursor" })
-  nmap("gW", fzf_lua.grep_cWORD, { desc = "Search WORD under cursor" })
-  nmap("sk", fzf_lua.keymaps, { desc = "Search Keymaps" })
-  nmap("sh", fzf_lua.help_tags, { desc = "Search help" })
-
-  -- Automatic sizing of height/width of vim.ui.select
-  fzf_lua.register_ui_select(function(_, items)
-    local min_h, max_h = 0.60, 0.80
-    local h = (#items + 4) / vim.o.lines
-    if h < min_h then
-      h = min_h
-    elseif h > max_h then
-      h = max_h
-    end
-    return { winopts = { height = h, width = 0.80, row = 0.40 } }
-  end)
-end
-
-return M

+ 0 - 143
lua/plugins/git.lua

@@ -88,149 +88,6 @@ local M = {
       nmap("<leader>gy", "<cmd>lua require('gitlinker').get_buf_range_url('n')<cr>")
     end,
   },
-  {
-    "polarmutex/git-worktree.nvim",
-    version = "^2",
-    dependencies = { "nvim-lua/plenary.nvim", "ibhagwan/fzf-lua", "folke/snacks.nvim" },
-    config = function()
-      local fzf_lua = require("fzf-lua")
-      local git_worktree = require("git-worktree")
-
-      -- Basic hooks
-      local Hooks = require("git-worktree.hooks")
-      Hooks.register(Hooks.type.SWITCH, Hooks.builtins.update_current_buffer_on_switch)
-
-      -- Switch worktrees
-      local function switch_worktree()
-        vim.system({ "git", "worktree", "list" }, {}, function(result)
-          if result.code ~= 0 then
-            return
-          end
-
-          local items = {}
-          for line in result.stdout:gmatch("[^\n]+") do
-            local path, branch = line:match("^([^%s]+)%s+%[?([^%]]*)")
-            if path and branch then
-              table.insert(items, path .. " (" .. (branch ~= "" and branch or "detached") .. ")")
-            end
-          end
-
-          vim.schedule(function()
-            fzf_lua.fzf_exec(items, {
-              prompt = "Worktrees> ",
-              actions = {
-                default = function(selected)
-                  local path = selected[1]:match("^([^%(]+)")
-                  git_worktree.switch_worktree(path:gsub("%s+$", ""))
-                end,
-              },
-            })
-          end)
-        end)
-      end
-
-      -- Create worktree
-      local function create_worktree()
-        -- Get the git directory (works for both regular and bare repos)
-        vim.system({ "git", "rev-parse", "--git-dir" }, {}, function(result)
-          if result.code ~= 0 then
-            vim.schedule(function()
-              vim.notify("Not in a git repository", vim.log.levels.ERROR)
-            end)
-            return
-          end
-
-          local git_dir = result.stdout:gsub("\n", "")
-          -- For bare repos, git-dir is the repo itself; for regular repos, get parent
-          local repo_root = git_dir:match("%.git$") and git_dir:gsub("/%.git$", "") or git_dir
-
-          vim.system({ "git", "branch", "-a" }, { cwd = repo_root }, function(branch_result)
-            if branch_result.code ~= 0 then
-              return
-            end
-
-            local branches = {}
-            for line in branch_result.stdout:gmatch("[^\n]+") do
-              local branch = line:gsub("^%s*%*?%s*", ""):gsub("^remotes/", "")
-              if branch ~= "" and not branch:match("HEAD") then
-                table.insert(branches, branch)
-              end
-            end
-
-            vim.schedule(function()
-              fzf_lua.fzf_exec(branches, {
-                prompt = "Base Branch> ",
-                actions = {
-                  default = function(selected)
-                    if not selected or #selected == 0 then
-                      return
-                    end
-                    local base_branch = selected[1]
-                    local default_name = base_branch:gsub(".*/", "")
-
-                    require("snacks").input({
-                      prompt = "Worktree name",
-                      default = default_name,
-                      icon = "🌿",
-                    }, function(name)
-                      if name then
-                        git_worktree.create_worktree(name, base_branch, "origin")
-                      end
-                    end)
-                  end,
-                },
-              })
-            end)
-          end)
-        end)
-      end
-
-      -- Delete worktree
-      local function delete_worktree()
-        local cwd = vim.fn.getcwd() -- Get this before async call
-
-        vim.system({ "git", "worktree", "list" }, {}, function(result)
-          if result.code ~= 0 then
-            return
-          end
-
-          local items = {}
-
-          for line in result.stdout:gmatch("[^\n]+") do
-            local path, branch = line:match("^([^%s]+)%s+%[?([^%]]*)")
-            if path and path ~= cwd then
-              table.insert(items, path .. " (" .. (branch ~= "" and branch or "detached") .. ")")
-            end
-          end
-
-          vim.schedule(function()
-            fzf_lua.fzf_exec(items, {
-              prompt = "Delete> ",
-              actions = {
-                default = function(selected)
-                  local path = selected[1]:match("^([^%(]+)"):gsub("%s+$", "")
-
-                  -- Simple vim.ui.select for yes/no
-                  vim.ui.select({ "Yes", "No" }, {
-                    prompt = "Delete worktree '" .. path .. "'?",
-                  }, function(choice)
-                    if choice == "Yes" then
-                      git_worktree.delete_worktree(path, true)
-                    end
-                  end)
-                end,
-              },
-            })
-          end)
-        end)
-      end
-
-      -- Keymaps
-      vim.keymap.set("n", "<leader>ws", switch_worktree, { desc = "Switch Worktree" })
-      vim.keymap.set("n", "<leader>wc", create_worktree, { desc = "Create Worktree" })
-      vim.keymap.set("n", "<leader>wd", delete_worktree, { desc = "Delete Worktree" })
-    end,
-  },
 }
 
 return M

+ 90 - 3
lua/plugins/qol.lua

@@ -1,5 +1,8 @@
 return {
   "folke/snacks.nvim",
+  dependencies = {
+    "nvim-lua/plenary.nvim",
+  },
   priority = 1000,
   init = function()
     local group = vim.api.nvim_create_augroup("BlinkCmpSnacksToggle", { clear = true })
@@ -41,7 +44,6 @@ return {
         win = { border = "rounded" },
       },
       debug = { enabled = true },
-      image = { enabled = true },
       indent = { enabled = true, animate = { enabled = false } },
       rename = { enabled = true },
       notifier = { enabled = true },
@@ -85,9 +87,94 @@ return {
       },
     })
 
-    nmap("<leader>.", snacks.scratch.open, { desc = "Toggle Scratch Buffer" })
-    nmap("<leader>,", snacks.scratch.select, { desc = "Select Scratch Buffer" })
     -- Show notifier history
     nmap("<leader>ns", snacks.notifier.show_history, { desc = "Show notifier history" })
+
+    -- -----------------
+    -- LSP
+    -- -----------------
+    nmap("gd", function()
+      snacks.picker.lsp_definitions()
+    end, { desc = "Goto Definition" })
+
+    nmap("gr", function()
+      snacks.picker.lsp_references({ include_current = false })
+    end, { desc = "Goto References" })
+
+    nmap("gi", function()
+      snacks.picker.lsp_implementations()
+    end, { desc = "Goto Implementation" })
+
+    nmap("<leader>D", function()
+      snacks.picker.lsp_type_definitions()
+    end, { desc = "Type Definition" })
+
+    nmap("<leader>ca", function()
+      vim.lsp.buf.code_action()
+    end, { desc = "Code Action" })
+
+    nmap("<leader>ds", function()
+      snacks.picker.lsp_symbols()
+    end, { desc = "Document Symbols" })
+
+    nmap("<leader>ic", function()
+      snacks.picker.lsp_incoming_calls()
+    end, { desc = "Incoming Calls" })
+
+    nmap("<leader>oc", function()
+      snacks.picker.lsp_outgoing_calls()
+    end, { desc = "Outgoing Calls" })
+
+    -- -----------------
+    -- Grep / Search
+    -- -----------------
+    nmap("<leader>gf", function()
+      snacks.picker.grep()
+    end, { desc = "Find Live Grep" })
+
+    nmap("sb", function()
+      snacks.picker.lines()
+    end, { desc = "Search Current Buffer" })
+
+    nmap("gw", function()
+      snacks.picker.grep_word()
+    end, { desc = "Search word under cursor" })
+
+    nmap("gW", function()
+      snacks.picker.grep_word({ word = vim.fn.expand("<cWORD>") })
+    end, { desc = "Search WORD under cursor" })
+
+    -- -----------------
+    -- Files
+    -- -----------------
+    nmap("<leader>/", function()
+      snacks.picker.files({
+        hidden = true,
+        ignored = true,
+        exclude = {
+          "node_modules",
+          ".git",
+          "dist",
+          "build",
+          "coverage",
+          "public",
+        },
+      })
+    end, { desc = "Find Files" })
+
+    -- -----------------
+    -- Buffers / Help / Keymaps
+    -- -----------------
+    nmap(";", function()
+      snacks.picker.buffers()
+    end, { desc = "Find Buffers" })
+
+    nmap("sk", function()
+      snacks.picker.keymaps()
+    end, { desc = "Search Keymaps" })
+
+    nmap("sh", function()
+      snacks.picker.help()
+    end, { desc = "Search Help" })
   end,
 }