refactor: reorganize, add package (opencode, osgrep, beads), add ai agent shell
This commit is contained in:
parent
7e0a207778
commit
a0f0f39399
58 changed files with 7867 additions and 42 deletions
58
modules/home/programs/nvim/lua/plugins/linting.lua
Normal file
58
modules/home/programs/nvim/lua/plugins/linting.lua
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
return {
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
event = { "BufReadPost", "BufNewFile", "BufWritePost" },
|
||||
opts = {
|
||||
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
|
||||
linters_by_ft = {
|
||||
javascript = { "eslint" },
|
||||
typescript = { "eslint" },
|
||||
javascriptreact = { "eslint" },
|
||||
typescriptreact = { "eslint" },
|
||||
python = { "ruff" },
|
||||
sh = { "shellcheck" },
|
||||
bash = { "shellcheck" },
|
||||
},
|
||||
linters = {},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local lint = require("lint")
|
||||
|
||||
-- Merge custom linter configs
|
||||
for name, linter in pairs(opts.linters) do
|
||||
if type(linter) == "table" and type(lint.linters[name]) == "table" then
|
||||
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter)
|
||||
else
|
||||
lint.linters[name] = linter
|
||||
end
|
||||
end
|
||||
|
||||
lint.linters_by_ft = opts.linters_by_ft
|
||||
|
||||
-- Debounced lint function with proper timer management
|
||||
local timer = vim.uv.new_timer()
|
||||
local function debounce_lint()
|
||||
-- Stop existing timer before starting new one to prevent EALREADY error
|
||||
timer:stop()
|
||||
timer:start(100, 0, vim.schedule_wrap(lint.try_lint))
|
||||
end
|
||||
|
||||
-- Create autocommand for linting
|
||||
vim.api.nvim_create_autocmd(opts.events, {
|
||||
group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }),
|
||||
callback = debounce_lint,
|
||||
})
|
||||
|
||||
-- Clean up timer on exit
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||
group = vim.api.nvim_create_augroup("nvim-lint-cleanup", { clear = true }),
|
||||
callback = function()
|
||||
if timer and not timer:is_closing() then
|
||||
timer:stop()
|
||||
timer:close()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue