init.lua/after/plugin/nvim-lint.lua

22 lines
500 B
Lua
Raw Normal View History

2023-12-24 20:55:03 +01:00
local lint = require("lint")
lint.linters.mypy.args = {
function()
local virtual = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX") or "/usr"
return "--python-executable", virtual .. "/bin/python3"
end,
}
lint.linters_by_ft = {
python = { "mypy", "ruff" },
}
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,
})