From c3aa71638857c4735a37591218e468f187c97072 Mon Sep 17 00:00:00 2001 From: CronyAkatsuki Date: Sun, 24 Dec 2023 20:55:03 +0100 Subject: [PATCH] Add additional linter support. --- after/plugin/nvim-lint.lua | 21 +++++++++++++++++++++ lua/crony/lazy.lua | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 after/plugin/nvim-lint.lua diff --git a/after/plugin/nvim-lint.lua b/after/plugin/nvim-lint.lua new file mode 100644 index 0000000..0fbb1e4 --- /dev/null +++ b/after/plugin/nvim-lint.lua @@ -0,0 +1,21 @@ +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, +}) diff --git a/lua/crony/lazy.lua b/lua/crony/lazy.lua index a50094d..fd7231d 100644 --- a/lua/crony/lazy.lua +++ b/lua/crony/lazy.lua @@ -149,6 +149,9 @@ require("lazy").setup({ -- additional formater support "stevearc/conform.nvim", + + -- additional linter support + "mfussenegger/nvim-lint", }, { install = { colorscheme = { "catppuccin" },