From: Samir Benmendil Date: Sun, 17 Dec 2023 17:28:40 +0000 (+0000) Subject: nvim: make MiniSurround behave more like tpope/surround X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/f618e70bcbd4919ed8af1d52bae104d36189afbb nvim: make MiniSurround behave more like tpope/surround --- diff --git a/nvim/lua/plugins/coding.lua b/nvim/lua/plugins/coding.lua index 7bf442f..bda4a98 100644 --- a/nvim/lua/plugins/coding.lua +++ b/nvim/lua/plugins/coding.lua @@ -92,10 +92,16 @@ return { -- surround { "echasnovski/mini.surround", - keys = { - { "S", "lua MiniSurround.add('visual')", "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 +115,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", [[:lua MiniSurround.add('visual')]], { silent = true }) + end, }, -- comments {