From 7cc46f0771352a1ac486df9bdeb5826712d11d33 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Sat, 15 Jul 2023 17:03:48 +0100 Subject: Add new colour scheme --- vim/nvim/lua/config/diagnostic.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 vim/nvim/lua/config/diagnostic.lua (limited to 'vim/nvim/lua/config/diagnostic.lua') diff --git a/vim/nvim/lua/config/diagnostic.lua b/vim/nvim/lua/config/diagnostic.lua new file mode 100644 index 0000000..afa9c87 --- /dev/null +++ b/vim/nvim/lua/config/diagnostic.lua @@ -0,0 +1,29 @@ +vim.diagnostic.config({ + underline = true, + signs = true, + virtual_text = false, + float = { + show_header = true, + source = 'if_many', + focusable = false, + transparent = true, + }, + update_in_insert = true, -- default to false + severity_sort = false, -- default to false +}) + +vim.api.nvim_exec([[ autocmd InsertEnter * :lua vim.diagnostic.config({virtual_text = true}) ]], false) +vim.api.nvim_exec([[ autocmd InsertLeave * :lua vim.diagnostic.config({virtual_text = false}) ]], false) +vim.api.nvim_exec([[ autocmd CursorMoved * :lua vim.diagnostic.open_float({ silent=true }) ]], false) + +vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + update_in_insert = true, + } +) + +local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } +for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) +end -- cgit v1.2.3-70-g09d2