-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnvim-lint.lua
More file actions
41 lines (37 loc) · 1008 Bytes
/
Copy pathnvim-lint.lua
File metadata and controls
41 lines (37 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
return {
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
local lint = require("lint")
lint.linters_by_ft = {
sh = {}, -- bashls
lua = {}, -- lua_ls
openscad = {}, -- openscad_lsp
python = {}, -- ruff_lsp
scala = {}, -- metals
yaml = {} -- yamlls,
}
-- define global vim variable (used by the neovim plugins code)
local luacheck = require('lint').linters.luacheck
luacheck.args = { '--global', 'vim', '--formatter', 'plain', '--codes', '--ranges', '-' }
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
vim.api.nvim_create_user_command("Lint", function()
lint.try_lint()
end, {
desc = "Lint (nvim-lint)",
})
end,
keys = {
{
"<leader>cl",
"<cmd>lua require('lint').try_lint()<cr>",
desc = "Lint code",
},
},
}