From f843419fe68dcbb8eda5ab6d0ed312742b71365e Mon Sep 17 00:00:00 2001 From: listout Date: Tue, 13 Sep 2022 21:10:01 +0530 Subject: nvim: plugins: lsp-config: virtual text and signs This commit will: - Turn off virtual text for diagnostics and error - use custom signs for error, diagnostics, ... - Stop using `vim.api.nvim_buf_set_option`. Don't know what it's used for Signed-off-by: listout --- lua/plugins/lsp-config.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/plugins/lsp-config.lua b/lua/plugins/lsp-config.lua index c4dce46..deb02d4 100644 --- a/lua/plugins/lsp-config.lua +++ b/lua/plugins/lsp-config.lua @@ -1,6 +1,23 @@ -- Add additional capabilities supported by nvim-cmp local M = {} +vim.diagnostic.config({ + virtual_text = false, + signs = true, + underline = true, + update_in_insert = false, + severity_sort = false, +}) + +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 = hl }) +end + +vim.o.updatetime = 250 +vim.cmd [[autocmd! CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]] + vim.cmd [[autocmd! ColorScheme * highlight NormalFloat guibg=#1f2335]] vim.cmd [[autocmd! ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335]] @@ -48,7 +65,8 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) -- after the language server attaches to the current buffer M.on_attach = function(client, bufnr) -- Enable completion triggered by - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + -- I don't need it. + -- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions -- cgit v1.2.3