don\'t display diagnostics by default
This commit is contained in:
parent
db99ea6566
commit
6ebd6e83c6
43
vimrc.lua
43
vimrc.lua
@ -99,6 +99,49 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Function to check if a floating dialog exists and if not
|
||||||
|
-- then check for diagnostics under the cursor
|
||||||
|
function OpenDiagnosticIfNoFloat()
|
||||||
|
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do
|
||||||
|
if vim.api.nvim_win_get_config(winid).zindex then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- THIS IS FOR BUILTIN LSP
|
||||||
|
vim.diagnostic.open_float(0, {
|
||||||
|
scope = "cursor",
|
||||||
|
focusable = false,
|
||||||
|
close_events = {
|
||||||
|
"CursorMoved",
|
||||||
|
"CursorMovedI",
|
||||||
|
"BufHidden",
|
||||||
|
"InsertCharPre",
|
||||||
|
"WinLeave",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false, -- Turn off inline diagnostics
|
||||||
|
})
|
||||||
|
-- Show all diagnostics on current line in floating window
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
'n', '<Leader>d', ':lua vim.diagnostic.open_float()<CR>',
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
-- Go to next diagnostic (if there are multiple on the same line, only shows
|
||||||
|
-- one at a time in the floating window)
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
'n', '<Leader>n', ':lua vim.diagnostic.goto_next()<CR>',
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
-- Go to prev diagnostic (if there are multiple on the same line, only shows
|
||||||
|
-- one at a time in the floating window)
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
'n', '<Leader>p', ':lua vim.diagnostic.goto_prev()<CR>',
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
|
||||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||||
-- map buffer local keybindings when the language server attaches
|
-- map buffer local keybindings when the language server attaches
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
|
Loading…
Reference in New Issue
Block a user