]> git.rmz.io Git - dotfiles.git/blobdiff - nvim/lua/plugins/editor.lua
nvim: add mini.hipatterns to highlight hex colours and any strings
[dotfiles.git] / nvim / lua / plugins / editor.lua
index 79380536571671e57a35f0591676249835c5f4c4..1e94ab0bc0a7b6e0362f71a349e54fc82e045d7c 100644 (file)
@@ -72,19 +72,28 @@ return {
   { "folke/todo-comments.nvim",
     -- Finds and lists all of the TODO, HACK, BUG, etc comment
     -- in your project and loads them into a browsable list.
-    cmd = { "TodoTrouble", "TodoTelescope" },
-    event = "LazyFile",
+    cmd = { "TodoTrouble"},
+    event = { "BufReadPost", "BufNewFile", "BufWritePre" },
     -- stylua: ignore
     keys = {
       { "]t", function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" },
       { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" },
       { "<leader>xt", "<cmd>Trouble todo toggle<cr>", desc = "Todo (Trouble)" },
       { "<leader>xT", "<cmd>Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
-      { "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
-      { "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
     },
     opts = {}
   },
+  { "echasnovski/mini.hipatterns",  -- highlight hex colours and other matched words
+    event = { "BufReadPost", "BufNewFile", "BufWritePre" },
+    opts = function()
+      local hi = require("mini.hipatterns")
+      return {
+        highlighters = {
+          hex_color = hi.gen_highlighter.hex_color({ priority = 2000 }),
+        },
+      }
+    end,
+  },
   { "folke/flash.nvim",
     -- Flash enhances the built-in search functionality by showing labels
     -- at the end of each match, letting you quickly jump to a specific
@@ -106,7 +115,7 @@ return {
     -- git signs highlights text that has changed since the list
     -- git commit, and also lets you interactively stage & unstage
     -- hunks in a commit.
-    event = "LazyFile",
+    event = { "BufReadPost", "BufNewFile", "BufWritePre" },
     opts = {
       signs = {
         add = { text = "▎" },
@@ -194,77 +203,7 @@ return {
       },
     },
   },
-  { "folke/which-key.nvim",
-    -- which-key helps you remember key bindings by showing a popup
-    -- with the active keybindings of the command you started typing.
-    -- TODO: replace with mini.clue
-    event = "VeryLazy",
-    opts_extend = { "spec" },
-    opts = {
-      preset = "helix",
-      defaults = {},
-      spec = {
-        {
-          mode = { "n", "v" },
-          { "<leader><tab>", group = "tabs" },
-          { "<leader>c", group = "code" },
-          { "<leader>d", group = "debug" },
-          { "<leader>dp", group = "profiler" },
-          { "<leader>f", group = "file/find" },
-          { "<leader>g", group = "git" },
-          { "<leader>gh", group = "hunks" },
-          { "<leader>q", group = "quit/session" },
-          { "<leader>s", group = "search" },
-          { "<leader>u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } },
-          { "<leader>x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } },
-          { "[", group = "prev" },
-          { "]", group = "next" },
-          { "g", group = "goto" },
-          { "gs", group = "surround" },
-          { "z", group = "fold" },
-          {
-            "<leader>b",
-            group = "buffer",
-            expand = function()
-              return require("which-key.extras").expand.buf()
-            end,
-          },
-          {
-            "<leader>w",
-            group = "windows",
-            proxy = "<c-w>",
-            expand = function()
-              return require("which-key.extras").expand.win()
-            end,
-          },
-          -- better descriptions
-          { "gx", desc = "Open with system app" },
-        },
-      },
-    },
-    keys = {
-      {
-        "<leader>?",
-        function()
-          require("which-key").show({ global = false })
-        end,
-        desc = "Buffer Keymaps (which-key)",
-      },
-      {
-        "<c-w><space>",
-        function()
-          require("which-key").show({ keys = "<c-w>", loop = true })
-        end,
-        desc = "Window Hydra Mode (which-key)",
-      },
-    },
-    config = function(_, opts)
-      local wk = require("which-key")
-      wk.setup(opts)
-      if not vim.tbl_isempty(opts.defaults) then
-        LazyVim.warn("which-key: opts.defaults is deprecated. Please use opts.spec instead.")
-        wk.register(opts.defaults)
-      end
-    end,
+  { "aymericbeaumet/vim-symlink",
+    dependencies = { "moll/vim-bbye" }, -- NOTE: Snacks.buddelete also provides this
   },
 }