diff --git a/lazy-lock.json b/lazy-lock.json index 8f73d56..0ae895c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -61,6 +61,7 @@ "nvim-dap-virtual-text": { "branch": "master", "commit": "baa5b0dc6663284cce32e0d00ac1f2511b13496f" }, "nvim-devdocs": { "branch": "master", "commit": "521d24661ffe6d1ba025debea2675c765a9c1ee1" }, "nvim-highlight-colors": { "branch": "main", "commit": "56e40d86a3202aedb0dbcded7aa6248c299eb0f0" }, + "nvim-lint": { "branch": "master", "commit": "4055dc856d5ac8f6b85748006fd8fa6457e086e8" }, "nvim-lspconfig": { "branch": "master", "commit": "6e5c78ebc9936ca74add66bda22c566f951b6ee5" }, "nvim-navbuddy": { "branch": "master", "commit": "f34237e8a41ebc6e2716af2ebf49854d8c5289c8" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, diff --git a/lua/plugins/nvim-lint.lua b/lua/plugins/nvim-lint.lua new file mode 100644 index 0000000..9ecf62e --- /dev/null +++ b/lua/plugins/nvim-lint.lua @@ -0,0 +1,19 @@ +return { + 'mfussenegger/nvim-lint', + config = function() + require('lint').linters_by_ft = { + cpp = { 'clangtidy', } + } + vim.api.nvim_create_autocmd({ 'BufWritePost' }, { + callback = function() + -- try_lint without arguments runs the linters defined in `linters_by_ft` + -- for the current filetype + require('lint').try_lint() + + -- You can call `try_lint` with a linter name or a list of names to always + -- run specific linters, independent of the `linters_by_ft` configuration + -- require('lint').try_lint('cspell') + end, + }) + end +}