added nvim-lint with clang-tidy

This commit is contained in:
Oliver Hartmann 2024-04-10 20:16:46 +02:00
parent eaada06d1a
commit d248b8866f
2 changed files with 20 additions and 0 deletions

View File

@ -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" },

19
lua/plugins/nvim-lint.lua Normal file
View File

@ -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
}