aboutsummaryrefslogtreecommitdiffstats
path: root/lua/plugins/minty.lua
blob: cb1775f6c04149dfffe74a6a160fda4161dddfd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
return {
  -- volt es requerido por minty (motor de UI)
  { "nvzone/volt", lazy = true },

  {
    "nvzone/minty",
    cmd = { "Shades", "Huefy" },
    keys = {
      { "<leader>cs", "<cmd>Shades<cr>", desc = "Color Shades Picker" },
      { "<leader>ch", "<cmd>Huefy<cr>", desc = "Color Hue Picker" },
    },
    config = function()
      require("minty").setup({
        huefy = {
          border = false,
          position = "cursor", -- cursor | center | func(w, h)

          -- Hook (no documentado) para añadir teclas dentro del picker.
          -- minty ya trae <C-s> = "Save": reemplaza el hex bajo el cursor.
          -- Aquí añadimos <C-y> = insertar el color elegido en el cursor,
          -- útil cuando NO hay un hex debajo para reemplazar.
          mappings = function(bufs)
            local state = require("minty.huefy.state")
            for _, buf in ipairs(bufs) do
              vim.keymap.set("n", "<C-y>", function()
                local hex = "#" .. state.new_hex
                require("volt").close()
                vim.api.nvim_put({ hex }, "c", true, true)
              end, { buffer = buf, desc = "Minty: insertar color en el cursor" })
            end
          end,
        },

        shades = {
          border = true,
          position = "cursor",
        },
      })
    end,
  },
}