Skip to content

Commit 34ab02e

Browse files
committed
✨ Linting support
1 parent af7cd04 commit 34ab02e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lua/fredrkl/plugins/nvim-lspconfig.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ return {
1616

1717
-- Additional lua configuration, makes nvim stuff amazing!
1818
'folke/neodev.nvim',
19+
'mfussenegger/nvim-lint', -- nvim-lint for linters
1920
},
2021
config = function()
2122
require("mason").setup({
@@ -153,5 +154,19 @@ return {
153154
on_attach = on_attach,
154155
filetypes = { "markdown" },
155156
})
157+
-- Setup nvim-lint for linters
158+
local lint = require("lint")
159+
lint.linters_by_ft = {
160+
lua = { "luacheck" }, -- example: Lua linter
161+
markdown = { "markdownlint-cli2" }, -- add markdown linter
162+
-- Add more filetypes and linters as needed
163+
}
164+
165+
-- Optionally, run lint on BufWritePost
166+
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
167+
callback = function()
168+
lint.try_lint()
169+
end,
170+
})
156171
end,
157172
}

0 commit comments

Comments
 (0)