dotfiles/modules/home/rsydn/programs/nvim/lua/plugins/coding.lua
2025-10-28 20:32:32 +07:00

80 lines
2.6 KiB
Lua

return {
-- Auto pairs
-- Automatically inserts a matching closing character
-- when you type an opening character like `"`, `[`, or `(`.
{
"nvim-mini/mini.pairs",
event = "VeryLazy",
opts = {
modes = { insert = true, command = true, terminal = false },
-- skip autopair when next character is one of these
skip_next = [=[[%w%%%'%[%"%%.%`%$]]=],
-- skip autopair when the cursor is inside these treesitter nodes
skip_ts = { "string" },
-- skip autopair when next character is closing pair
-- and there are more closing pairs than opening pairs
skip_unbalanced = true,
-- better deal with markdown code blocks
markdown = true,
},
config = function(_, opts)
LazyVim.mini.pairs(opts)
end,
},
-- Improves comment syntax, lets Neovim handle multiple
-- types of comments for a single language, and relaxes rules
-- for uncommenting.
{
"folke/ts-comments.nvim",
event = "VeryLazy",
opts = {},
},
-- Extends the a & i text objects, this adds the ability to select
-- arguments, function calls, text within quotes and brackets
{
"nvim-mini/mini.ai",
event = "VeryLazy",
opts = function()
local ai = require("mini.ai")
return {
n_lines = 500,
custom_textobjects = {
o = ai.gen_spec.treesitter({
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" }),
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }),
t = { "<(%p%w-)%f[^<%w][^<>]->.*()</[^/]->$" },
d = { "%f[%d]%d+" },
e = { { "%u[%l%d]+%f[^%l%d]", "%f[%S][%l%d]+%f[^%l%d]" }, "^().*()$" },
g = LazyVim.mini.ai_buffer,
u = ai.gen_spec.function_call(),
U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }),
},
}
end,
config = function(_, opts)
require("mini.ai").setup(opts)
-- mini.clue handles text object hints automatically
end,
},
-- Configures LuaLS to support auto-completion and type checking
-- while editing your Neovim configuration.
{
"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 = { "LazyVim" } },
},
},
},
}