nvim-nix/nvim/lua/plugins/mini.lua
2025-09-06 13:48:36 +03:00

111 lines
3.7 KiB
Lua

return {
{
"echasnovski/mini.icons",
event = "VeryLazy",
config = function()
require("mini.icons").setup()
MiniIcons.mock_nvim_web_devicons()
end,
},
-- 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)
-- stylua: ignore start
local mappings = {
{ opts.mappings.add, desc = "Add surrounding", mode = { "n", "v" } },
{ opts.mappings.delete, desc = "Delete surrounding", mode = { "n" } },
{ 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`" },
}
-- stylua: ignore end
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 = "gza", -- Add surrounding in Normal and Visual modes
delete = "gzd", -- Delete surrounding
find = "gzf", -- Find surrounding (to the right)
find_left = "gzF", -- Find surrounding to the left
highlight = "gzh", -- Highlight surrounding
replace = "gzr", -- Replace surrounding
update_n_lines = "gzn", -- Update `n_lines`
},
},
},
{
"echasnovski/mini.ai",
event = "ModeChanged",
opts = {
-- Table with textobject id as fields, textobject specification as values.
-- Also use this to disable builtin textobjects. See |MiniAi.config|.
custom_textobjects = nil,
-- Module mappings. Use `''` (empty string) to disable one.
mappings = {
-- Main textobject prefixes
around = "a",
inside = "i",
-- Next/last variants
around_next = "an",
inside_next = "in",
around_last = "al",
inside_last = "il",
-- Move cursor to corresponding edge of `a` textobject
goto_left = "g[",
goto_right = "g]",
},
-- Number of lines within which textobject is searched
n_lines = 50,
-- How to search for object (first inside current line, then inside
-- neighborhood). One of 'cover', 'cover_or_next', 'cover_or_prev',
-- 'cover_or_nearest', 'next', 'previous', 'nearest'.
search_method = "cover_or_next",
-- Whether to disable showing non-error feedback
silent = false,
},
},
{
"echasnovski/mini.misc",
config = function()
local misc = require("mini.misc")
misc.setup()
misc.setup_auto_root(vim.g.root_pattern)
local data = vim.fn.stdpath("data")
vim.opt.shadafile = (function()
local cwd = require("funcs").shorten_path(vim.fn.getcwd())
local file = vim.fs.joinpath(data, "project_shada", cwd)
vim.fn.mkdir(vim.fs.dirname(file), "p")
return file
end)()
vim.opt.viewdir = data .. "/" .. "view"
-- last position
misc.setup_restore_cursor({
ignore_filetype = { "largefile", "gitcommit", "gitrebase", "svn", "hgcommit" },
})
end,
},
}