]> git.rmz.io Git - dotfiles.git/blobdiff - nvim/lua/plugins/coding.lua
nvim: replace vim-surround with mini.surround
[dotfiles.git] / nvim / lua / plugins / coding.lua
index 6e8adc99e7e8c08c5e32beb558b393a3556d7176..a2e1538516cf10c5a281727e0968ebf5bba9dd56 100644 (file)
@@ -12,6 +12,7 @@ return {
   -- auto completion
   {
     "hrsh7th/nvim-cmp",
+    ---@param opts cmp.ConfigSchema
     opts = function(_, opts)
       local has_words_before = function()
         unpack = unpack or table.unpack
@@ -23,7 +24,7 @@ return {
       local luasnip = require("luasnip")
 
       opts.completion = vim.tbl_extend("force", opts.completion, {
-        completeopt = "menu,menuone,noinsert",
+        completeopt = "menu,menuone,noselect",
       })
       --TODO: review if I want to keep any of LazyVim's mappings
       opts.mapping = vim.tbl_extend("force", opts.mapping, {
@@ -50,4 +51,31 @@ return {
       })
     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 = "",
+      },
+    },
+  },
 }