mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-30 04:24:35 +02:00
feat(mini.surround)!: move mini.surround
to an extra
This commit is contained in:
parent
69e6daae2c
commit
e37a699096
3 changed files with 37 additions and 37 deletions
|
@ -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
|
-- comments
|
||||||
{
|
{
|
||||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||||
|
|
36
lua/lazyvim/plugins/extras/coding/mini-surround.lua
Normal file
36
lua/lazyvim/plugins/extras/coding/mini-surround.lua
Normal file
|
@ -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`
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -38,6 +38,7 @@ return {
|
||||||
-- rename surround mappings from gs to gz to prevent conflict with leap
|
-- rename surround mappings from gs to gz to prevent conflict with leap
|
||||||
{
|
{
|
||||||
"echasnovski/mini.surround",
|
"echasnovski/mini.surround",
|
||||||
|
optional = true,
|
||||||
opts = {
|
opts = {
|
||||||
mappings = {
|
mappings = {
|
||||||
add = "gza", -- Add surrounding in Normal and Visual modes
|
add = "gza", -- Add surrounding in Normal and Visual modes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue