]> git.rmz.io Git - dotfiles.git/blobdiff - nvim/lua/plugins/coding.lua
nvim/coding: use snippets from vim-snippets
[dotfiles.git] / nvim / lua / plugins / coding.lua
index 263071dbc127fb61a2fd31b7d178df6ffbe2a95c..6194756e394ce4d5e4ab1c4d36fea3ecfc522a06 100644 (file)
@@ -4,6 +4,14 @@ return {
   {
     "L3MON4D3/LuaSnip",
     -- disable luasnip bindings for <tab> and <s-tab>
   {
     "L3MON4D3/LuaSnip",
     -- disable luasnip bindings for <tab> and <s-tab>
+    dependencies = {
+      {
+        "honza/vim-snippets",
+        config = function()
+          require("luasnip.loaders.from_snipmate").lazy_load()
+        end,
+      },
+    },
     keys = function()
       return {}
     end,
     keys = function()
       return {}
     end,
@@ -12,6 +20,7 @@ return {
   -- auto completion
   {
     "hrsh7th/nvim-cmp",
   -- auto completion
   {
     "hrsh7th/nvim-cmp",
+    ---@param opts cmp.ConfigSchema
     opts = function(_, opts)
       local has_words_before = function()
         unpack = unpack or table.unpack
     opts = function(_, opts)
       local has_words_before = function()
         unpack = unpack or table.unpack
@@ -50,4 +59,31 @@ return {
       })
     end,
   },
       })
     end,
   },
+
+  -- auto pairs
+  {
+    "echasnovski/mini.pairs",
+  },
+
+  -- surround
+  {
+    "echasnovski/mini.surround",
+    keys = {
+      { "S", "<cmd><C-u>lua MiniSurround.add('visual')<cr>", "x" },
+      { "yss", "ys_", remap = true },
+    },
+    opts = {
+      mappings = {
+        -- TODO: this is tpope/surround like, but should consider using vim-sandwich mappings
+        -- see: :h MiniSurround-vim-surround-config
+        add = "ys",
+        delete = "ds",
+        find = "",
+        find_left = "",
+        highlight = "",
+        replace = "cs",
+        update_n_lines = "",
+      },
+    },
+  },
 }
 }