diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index d4070b4c..30331e10 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -181,43 +181,6 @@ return { }, }, - -- Fast and feature-rich surround actions. For text that includes - -- surrounding characters like brackets or quotes, this allows you - -- to select the text inside, change or modify the surrounding characters, - -- and more. - { - "echasnovski/mini.surround", - keys = function(_, keys) - -- Populate the keys based on the user's options - local plugin = require("lazy.core.config").spec.plugins["mini.surround"] - local opts = require("lazy.core.plugin").values(plugin, "opts", false) - local mappings = { - { opts.mappings.add, desc = "Add Surrounding", mode = { "n", "v" } }, - { opts.mappings.delete, desc = "Delete Surrounding" }, - { opts.mappings.find, desc = "Find Right Surrounding" }, - { opts.mappings.find_left, desc = "Find Left Surrounding" }, - { opts.mappings.highlight, desc = "Highlight Surrounding" }, - { opts.mappings.replace, desc = "Replace Surrounding" }, - { opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" }, - } - mappings = vim.tbl_filter(function(m) - return m[1] and #m[1] > 0 - end, mappings) - return vim.list_extend(mappings, keys) - end, - opts = { - mappings = { - add = "gsa", -- Add surrounding in Normal and Visual modes - delete = "gsd", -- Delete surrounding - find = "gsf", -- Find surrounding (to the right) - find_left = "gsF", -- Find surrounding (to the left) - highlight = "gsh", -- Highlight surrounding - replace = "gsr", -- Replace surrounding - update_n_lines = "gsn", -- Update `n_lines` - }, - }, - }, - -- comments { "JoosepAlviste/nvim-ts-context-commentstring", diff --git a/lua/lazyvim/plugins/extras/coding/mini-surround.lua b/lua/lazyvim/plugins/extras/coding/mini-surround.lua new file mode 100644 index 00000000..101903e6 --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/mini-surround.lua @@ -0,0 +1,36 @@ +-- Fast and feature-rich surround actions. For text that includes +-- surrounding characters like brackets or quotes, this allows you +-- to select the text inside, change or modify the surrounding characters, +-- and more. +return { + "echasnovski/mini.surround", + keys = function(_, keys) + -- Populate the keys based on the user's options + local plugin = require("lazy.core.config").spec.plugins["mini.surround"] + local opts = require("lazy.core.plugin").values(plugin, "opts", false) + local mappings = { + { opts.mappings.add, desc = "Add Surrounding", mode = { "n", "v" } }, + { opts.mappings.delete, desc = "Delete Surrounding" }, + { opts.mappings.find, desc = "Find Right Surrounding" }, + { opts.mappings.find_left, desc = "Find Left Surrounding" }, + { opts.mappings.highlight, desc = "Highlight Surrounding" }, + { opts.mappings.replace, desc = "Replace Surrounding" }, + { opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" }, + } + mappings = vim.tbl_filter(function(m) + return m[1] and #m[1] > 0 + end, mappings) + return vim.list_extend(mappings, keys) + end, + opts = { + mappings = { + add = "gsa", -- Add surrounding in Normal and Visual modes + delete = "gsd", -- Delete surrounding + find = "gsf", -- Find surrounding (to the right) + find_left = "gsF", -- Find surrounding (to the left) + highlight = "gsh", -- Highlight surrounding + replace = "gsr", -- Replace surrounding + update_n_lines = "gsn", -- Update `n_lines` + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/editor/leap.lua b/lua/lazyvim/plugins/extras/editor/leap.lua index 19bfd4a8..afcdc4b7 100644 --- a/lua/lazyvim/plugins/extras/editor/leap.lua +++ b/lua/lazyvim/plugins/extras/editor/leap.lua @@ -38,6 +38,7 @@ return { -- rename surround mappings from gs to gz to prevent conflict with leap { "echasnovski/mini.surround", + optional = true, opts = { mappings = { add = "gza", -- Add surrounding in Normal and Visual modes