diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-20 10:53:14 -0500 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-20 10:54:02 -0500 |
| commit | 7b6dbb921650e2a52929f025b67be57609fda6d4 (patch) | |
| tree | 895416312698cfe4ac61d4eed0f071d7743c0214 /.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua | |
| parent | Remove openbsd conditional in zsh (diff) | |
| download | dotfiles-7b6dbb921650e2a52929f025b67be57609fda6d4.zip | |
Rework dotfiles to *only* contain dotfiles
Diffstat (limited to '.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua')
| -rw-r--r-- | .config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua b/.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua new file mode 100644 index 0000000..8c5ada0 --- /dev/null +++ b/.config/nvim/lua/eugenetriguba/plugins/nvim-lint.lua @@ -0,0 +1,46 @@ +vim.pack.add { + { + name = 'nvim-lint', + src = 'https://github.com/mfussenegger/nvim-lint', + }, +} +-- Default linters, which will cause errors unless these tools are available: +-- { +-- clojure = { "clj-kondo" }, +-- dockerfile = { "hadolint" }, +-- inko = { "inko" }, +-- janet = { "janet" }, +-- json = { "jsonlint" }, +-- markdown = { "vale" }, +-- rst = { "vale" }, +-- ruby = { "ruby" }, +-- terraform = { "tflint" }, +-- text = { "vale" } +-- } +-- +-- They can be disabled by setting their filetypes to nil: +-- lint.linters_by_ft['clojure'] = nil +local lint = require 'lint' +lint.linters_by_ft = lint.linters_by_ft or {} +lint.linters_by_ft['cpp'] = { 'cppcheck' } +lint.linters_by_ft['dockerfile'] = { 'hadolint' } +lint.linters_by_ft['json'] = { 'jsonlint' } +lint.linters_by_ft['terraform'] = { 'tflint', 'terraform_validate' } +lint.linters_by_ft['python'] = { 'ruff' } +lint.linters_by_ft['markdown'] = nil +lint.linters_by_ft['text'] = nil +lint.linters_by_ft['xml'] = { 'xmllint' } +lint.linters_by_ft['sh'] = { 'shellcheck' } +table.insert(lint.linters.shellcheck.args, '-x') +local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) +vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { + group = lint_augroup, + callback = function() + -- Only run the linter in buffers that you can modify in order to + -- avoid superfluous noise, notably within the handy LSP pop-ups that + -- describe the hovered symbol using Markdown. + if vim.opt_local.modifiable:get() then + lint.try_lint() + end + end, +}) |