(nvim) add linter plugin
This commit is contained in:
parent
bc89283e6d
commit
a1f90fcd49
2 changed files with 51 additions and 13 deletions
39
nvim/lua/juancwu/plugins/nvim-lint.lua
Normal file
39
nvim/lua/juancwu/plugins/nvim-lint.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
local linters_by_ft = {
|
||||
javascript = { "biomejs" },
|
||||
typescript = { "biomejs" },
|
||||
javascriptreact = { "biomejs" },
|
||||
typescriptreact = { "biomejs" },
|
||||
jsonc = { "biomejs" },
|
||||
json = { "biomejs" },
|
||||
css = { "biomejs" },
|
||||
}
|
||||
|
||||
return {
|
||||
"mfussenegger/nvim-lint",
|
||||
event = { "BufWritePost" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>lf",
|
||||
function()
|
||||
require("lint").try_lint()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "[L]int [F]ile",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local lint = require("lint")
|
||||
|
||||
lint.linters_by_ft = linters_by_ft
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("Lint", function()
|
||||
lint.try_lint()
|
||||
end, { desc = "Lint file" })
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue