home: vim: move diagnostics config to 'on_attach'
This commit is contained in:
parent
336d86d2d8
commit
d3c04107bf
|
@ -18,6 +18,28 @@ end
|
||||||
-- @param client native client configuration
|
-- @param client native client configuration
|
||||||
-- @param bufnr int? buffer number of the attched client
|
-- @param bufnr int? buffer number of the attched client
|
||||||
M.on_attach = function(client, bufnr)
|
M.on_attach = function(client, bufnr)
|
||||||
|
-- Diagnostics
|
||||||
|
vim.diagnostic.config({
|
||||||
|
-- Disable virtual test next to affected regions
|
||||||
|
virtual_text = false,
|
||||||
|
-- Show diagnostics signs
|
||||||
|
signs = true,
|
||||||
|
-- Underline offending regions
|
||||||
|
underline = true,
|
||||||
|
-- Do not bother me in the middle of insertion
|
||||||
|
update_in_insert = false,
|
||||||
|
-- Show highest severity first
|
||||||
|
severity_sort = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd([[
|
||||||
|
augroup DiagnosticsHover
|
||||||
|
autocmd! * <buffer>
|
||||||
|
" Show diagnostics on "hover"
|
||||||
|
autocmd CursorHold,CursorHoldI <buffer> lua vim.diagnostic.open_float(nil, {focus=false, scope="cursor"})
|
||||||
|
augroup END
|
||||||
|
]])
|
||||||
|
|
||||||
-- Format on save
|
-- Format on save
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
lua << EOF
|
|
||||||
vim.diagnostic.config({
|
|
||||||
-- Disable virtual test next to affected regions
|
|
||||||
virtual_text = false,
|
|
||||||
-- Show diagnostics signs
|
|
||||||
signs = true,
|
|
||||||
-- Underline offending regions
|
|
||||||
underline = true,
|
|
||||||
-- Do not bother me in the middle of insertion
|
|
||||||
update_in_insert = false,
|
|
||||||
-- Show highest severity first
|
|
||||||
severity_sort = true,
|
|
||||||
})
|
|
||||||
EOF
|
|
||||||
|
|
||||||
augroup DiagnosticsHover
|
|
||||||
autocmd!
|
|
||||||
" Show diagnostics on "hover"
|
|
||||||
autocmd! CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false, scope="cursor"})
|
|
||||||
augroup END
|
|
Loading…
Reference in a new issue