]> git.rmz.io Git - dotfiles.git/blobdiff - nvim/lua/plugins/coding.lua
nvim: absorb yanky, but leave it disabled for now
[dotfiles.git] / nvim / lua / plugins / coding.lua
index 43ce1e09f46f109bb66f0a66c7fdfaf57728c4ab..77d49557b73989443648b733a9a2ac86792eb5bb 100644 (file)
@@ -1,22 +1,22 @@
 ---@type LazySpec
 return {
   -- snippets
-  {
-    "L3MON4D3/LuaSnip",
-    -- disable luasnip bindings for <tab> and <s-tab>
+  { "l3mon4d3/luasnip",
+    build = "make install_jsregexp", -- optional
     dependencies = {
-      {
-        "honza/vim-snippets",
-        config = function()
-          require("luasnip.loaders.from_snipmate").lazy_load()
-          require("luasnip.loaders.from_lua").load({ paths = vim.fn.stdpath("config") .. "/lua/snippets" })
-        end,
-      },
+      { "honza/vim-snippets", },
     },
+    config = function()
+      local snippets = vim.fn.stdpath("config").."/snippets"
+      require("luasnip.loaders.from_snipmate").load({ paths = { snippets }})
+      require("luasnip.loaders.from_lua").load({ paths = { snippets }})
+    end,
     keys = function()
       return {}
     end,
     opts = {
+      history = true,
+      delete_check_events = "TextChanged",
       store_selection_keys = "<Tab>",
     },
   },
@@ -146,15 +146,34 @@ return {
     end,
   },
   { "numToStr/Comment.nvim",
+    dependencies = {
+      { "JoosepAlviste/nvim-ts-context-commentstring",  -- nested language commenting (f.ex markdown code blocks)
+        opts = { enable_autocmd = false, },
+      }
+    },
+    opts = function(_, opts)
+      local tscci = require('ts_context_commentstring.integrations.comment_nvim')
+      vim.tbl_deep_extend('force', opts, {
+        toggler = {
+          line = "gcc",
+          block = "gbb",
+        },
+        mappings = {
+          basic = true,
+          extra = true,
+        },
+        pre_hook = tscci.create_pre_hook()
+      })
+      return opts
+    end,
+  },
+  { "danymat/neogen",  -- Generate annotations like doxygen
+    cmd = "Neogen",
+    keys = {
+      { "<leader>cn", function() require("neogen").generate() end, desc = "Generate Annotations (Neogen)", },
+    },
     opts = {
-      toggler = {
-        line = "gcc",
-        block = "gbb",
-      },
-      mappings = {
-        basic = true,
-        extra = true,
-      },
+      snippet_engine = "luasnip",
     },
   },
   { "folke/lazydev.nvim",
@@ -163,10 +182,53 @@ return {
     opts = {
       library = {
         { path = "${3rd}/luv/library", words = { "vim%.uv" } },
-        { path = "LazyVim", words = { "LazyVim" } },
         { path = "snacks.nvim", words = { "Snacks" } },
         { path = "lazy.nvim", words = { "LazySpec" } },
       },
     },
   },
+  { "gbprod/yanky.nvim", enabled = false, -- better yank/paste
+    -- TODO: integrate?
+    -- I'm not entirely convinced, it doesn't provide functionality like vim-peekaboo, 
+    -- maybe it can supplement it though?
+    -- Also, see issues on OSC52: https://github.com/gbprod/yanky.nvim/issues/213
+    recommended = true,
+    desc = "Better Yank/Paste",
+    event = "LazyFile",
+    opts = {
+      highlight = { timer = 150 },
+    },
+    keys = {
+      {
+        "<leader>p",
+        function() vim.cmd([[YankyRingHistory]]) end,
+        mode = { "n", "x" },
+        desc = "Open Yank History",
+      },
+      -- stylua: ignore
+      { "y", "<Plug>(YankyYank)", mode = { "n", "x" }, desc = "Yank Text" },
+      { "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Text After Cursor" },
+      { "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Cursor" },
+      { "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put Text After Selection" },
+      { "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Selection" },
+      { "[y", "<Plug>(YankyCycleForward)", desc = "Cycle Forward Through Yank History" },
+      { "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle Backward Through Yank History" },
+      { "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" },
+      { "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" },
+      { "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)" },
+      { "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)" },
+      { ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and Indent Right" },
+      { "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and Indent Left" },
+      { ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put Before and Indent Right" },
+      { "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put Before and Indent Left" },
+      { "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put After Applying a Filter" },
+      { "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" },
+    },
+  },
+
+  { "andrewferrier/debugprint.nvim",
+    dependencies = { "nvim-treesitter" },
+    -- TODO: setup debugprint (or maybe not)
+    opts = { }
+  }
 }