Skip to main content

Coding

Includes the following extras

mini.pairs

auto pairs

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,
}

ts-comments.nvim

comments

opts = {}

mini.ai

Better text-objects

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]" },
"^().*()$",
},
g = LazyVim.mini.ai_buffer, -- buffer
u = ai.gen_spec.function_call(), -- u for "Usage"
U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name
},
}
end

lazydev.nvim

opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
{ path = "LazyVim", words = { "LazyVim" } },
{ path = "snacks.nvim", words = { "Snacks" } },
{ path = "lazy.nvim", words = { "LazyVim" } },
},
}