Skip to content

Commit 94207b8

Browse files
committed
Add nvim-lint for more diagnostics
1 parent 661fe5e commit 94207b8

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

init.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ require('lazy').setup({
731731
jump = { float = true, wrap = false },
732732
severity_sort = true,
733733
float = { source = 'if_many' },
734-
underline = { severity = vim.diagnostic.severity.ERROR },
735734
signs = vim.g.have_nerd_font and {
736735
text = {
737736
[vim.diagnostic.severity.ERROR] = '󰅚 ',
@@ -740,7 +739,10 @@ require('lazy').setup({
740739
[vim.diagnostic.severity.HINT] = '󰌶 ',
741740
},
742741
} or {},
743-
virtual_lines = true,
742+
virtual_text = {
743+
source = 'if_many',
744+
spacing = 2,
745+
},
744746
}
745747

746748
-- LSP servers and clients are able to communicate to each other what features they support.
@@ -761,7 +763,6 @@ require('lazy').setup({
761763
local servers = {
762764
clangd = {
763765
'clangd',
764-
'--clang-tidy',
765766
},
766767
-- gopls = {},
767768
pylsp = {},

lua/custom/plugins/init.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,22 @@ return {
282282
})
283283
end,
284284
},
285+
{
286+
'mfussenegger/nvim-lint',
287+
event = { 'BufEnter', 'BufWritePost', 'InsertLeave' },
288+
config = function()
289+
require('lint').linters_by_ft = {
290+
c = { 'clangtidy' },
291+
cpp = { 'clangtidy' },
292+
}
293+
294+
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
295+
callback = function()
296+
-- try_lint without arguments runs the linters defined in `linters_by_ft`
297+
-- for the current filetype
298+
require('lint').try_lint()
299+
end,
300+
})
301+
end,
302+
},
285303
}

0 commit comments

Comments
 (0)