]> git.rmz.io Git - dotfiles.git/blobdiff - nvim/lua/plugins/coding.lua
nvim: get cpp lang from lazyvim
[dotfiles.git] / nvim / lua / plugins / coding.lua
index 7bf442fe954d7956c4062b013dae9fea1216a151..324dc4ea1b71758902b3c074bcc3ab5f0e942658 100644 (file)
@@ -9,6 +9,7 @@ return {
         "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,
       },
     },
@@ -92,10 +93,16 @@ return {
   -- surround
   {
     "echasnovski/mini.surround",
-    keys = {
-      { "S", "<cmd><C-u>lua MiniSurround.add('visual')<cr>", "x" },
-      { "yss", "ys_", remap = true },
-    },
+    keys = function()
+      -- HACK: use function to disable merging with LazyVim's keys definition
+      return {
+        { "ys", desc = "Add surrounding", "n" },
+        { "S", desc = "Add surrounding", "x" },
+        { "ds", desc = "Delete surrounding" },
+        { "cs", desc = "Change surrounding" },
+        { "yss", "ys_", remap = true },
+      }
+    end,
     opts = {
       mappings = {
         -- TODO: this is tpope/surround like, but should consider using vim-sandwich mappings
@@ -109,6 +116,12 @@ return {
         update_n_lines = "",
       },
     },
+    config = function(_, opts)
+      require("mini.surround").setup(opts)
+      -- remap visual
+      vim.keymap.del("x", "ys", { silent = true })
+      vim.keymap.set("x", "S", [[:<C-u>lua MiniSurround.add('visual')<CR>]], { silent = true })
+    end,
   },
   -- comments
   {