+ { "echasnovski/mini.surround",
+ 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
+ -- see: :h MiniSurround-vim-surround-config
+ add = "ys",
+ delete = "ds",
+ find = "",
+ find_left = "",
+ highlight = "",
+ replace = "cs",
+ 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", [[:<C-u>lua MiniSurround.add('visual')<CR>]], { silent = true })
+ end,
+ },
+
+ { "echasnovski/mini.ai",
+ -- TODO: port vim text objects over
+ event = "VeryLazy",
+ opts = function()
+ local ai = require("mini.ai")
+ return {
+ n_lines = 500,
+ custom_textobjects = {
+ o = ai.gen_spec.treesitter({ -- code block
+ a = { "@block.outer", "@conditional.outer", "@loop.outer" },
+ i = { "@block.inner", "@conditional.inner", "@loop.inner" },
+ }),
+ f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }), -- function
+ c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }), -- class
+ t = { "<([%p%w]-)%f[^<%w][^<>]->.-</%1>", "^<.->().*()</[^/]->$" }, -- tags
+ d = { "%f[%d]%d+" }, -- digits
+ e = { -- Word with case
+ { "%u[%l%d]+%f[^%l%d]", "%f[%S][%l%d]+%f[^%l%d]", "%f[%P][%l%d]+%f[^%l%d]", "^[%l%d]+%f[^%l%d]" },
+ "^().*()$",
+ },
+ u = ai.gen_spec.function_call(), -- u for "Usage"
+ U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name
+ },
+ }
+ end,
+ },
+ { "numToStr/Comment.nvim",
+ opts = {
+ toggler = {
+ line = "gcc",
+ block = "gbb",
+ },
+ mappings = {
+ basic = true,
+ extra = true,
+ },
+ },
+ },
+ { "folke/lazydev.nvim",
+ ft = "lua",
+ cmd = "LazyDev",
+ opts = {
+ library = {
+ { path = "${3rd}/luv/library", words = { "vim%.uv" } },
+ { path = "LazyVim", words = { "LazyVim" } },
+ { path = "snacks.nvim", words = { "Snacks" } },
+ { path = "lazy.nvim", words = { "LazySpec" } },
+ },
+ },