diff --git a/nvim/init.lua b/nvim/init.lua index 81a15de..738893f 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -16,7 +16,7 @@ end -- Load keymaps before loading any plugins require("keymaps") --- change and personalize native vim settings +-- Change and personalize native vim settings vim.opt = require("vim_opt") -- Initialize Lazy package manager @@ -40,6 +40,9 @@ require("dap/setup") -- See ":help vim.highlight.on_yank()" setup_yank_highlight() +-- Change built in settings related to diagnostics +require("diagnostics") + --[[ -- Annoyances in Neovim environment: -- 1. codelldb doesn't terminate C++ program after debugging. : Don't know how to fix, have asked for help. diff --git a/nvim/lua/diagnostics.lua b/nvim/lua/diagnostics.lua new file mode 100644 index 0000000..8bbfc18 --- /dev/null +++ b/nvim/lua/diagnostics.lua @@ -0,0 +1,37 @@ +local colors = require("ayu.colors") +colors.generate(true) +-- These are not apart of the Ayu color theme, however, I needed these +-- colors while still fitting in with the rest +local ayu_turquoise = "#5CCFE6" +local ayu_dark_blue = "#3A7BD5" +for _, highlight in ipairs({ + { "DiagnosticUnderlineError", { undercurl = true, sp = colors.error } }, + { "DiagnosticUnderlineWarn", { undercurl = true, sp = colors.warning } }, + { "DiagnosticUnderlineHint", { undercurl = true, sp = ayu_turquoise } }, + { "DiagnosticUnderlineInfo", { undercurl = true, sp = ayu_dark_blue } }, +}) do + vim.api.nvim_set_hl(0, highlight[1], highlight[2]) +end + +local sev = vim.diagnostic.severity +vim.diagnostic.config({ + underline = true, + virtual_text = { + prefix = "●", + }, + update_in_insert = true, + signs = { + text = { + [sev.ERROR] = "", + [sev.WARN] = "", + [sev.INFO] = "", + [sev.HINT] = "", + }, + numhl = { + [sev.WARN] = "WarningMsg", + [sev.ERROR] = "ErrorMsg", + [sev.INFO] = "DiagnosticInfo", + [sev.HINT] = "DiagnosticHint", + }, + }, +}) diff --git a/nvim/lua/lsp/setup.lua b/nvim/lua/lsp/setup.lua index 717d2dc..73f85b5 100644 --- a/nvim/lua/lsp/setup.lua +++ b/nvim/lua/lsp/setup.lua @@ -58,13 +58,6 @@ end local global_capabilities = require("blink.cmp").get_lsp_capabilities() global_capabilities.offsetEncoding = { "utf-16" } -vim.diagnostic.config({ - underline = true, -- Underline diagnostic errors - virtual_text = false, -- Disable inline text messages - signs = true, -- Show icons in the sign column - update_in_insert = true, -- Update diagnostics during insert mode -}) - vim.lsp.config("*", { capabilities = global_capabilities, handlers = { diff --git a/nvim/lua/plugs/tiny-inline-diagnostics.lua b/nvim/lua/plugs/tiny-inline-diagnostics.lua deleted file mode 100644 index 29a7d4a..0000000 --- a/nvim/lua/plugs/tiny-inline-diagnostics.lua +++ /dev/null @@ -1,27 +0,0 @@ -return { - "rachartier/tiny-inline-diagnostic.nvim", - event = "VeryLazy", - priority = 1000, - config = function() - require("tiny-inline-diagnostic").setup() - - vim.diagnostic.config({ - virtual_text = false, - }) - - local colors = require("ayu.colors") - colors.generate(true) - -- These are not apart of the Ayu color theme, however, I needed these - -- colors while still fitting in with the rest - local ayu_turquoise = "#5CCFE6" - local ayu_dark_blue = "#3A7BD5" - for _, highlight in ipairs({ - { "DiagnosticUnderlineError", { undercurl = true, sp = colors.error } }, - { "DiagnosticUnderlineWarn", { undercurl = true, sp = colors.warning } }, - { "DiagnosticUnderlineHint", { undercurl = true, sp = ayu_turquoise } }, - { "DiagnosticUnderlineInfo", { undercurl = true, sp = ayu_dark_blue } }, - }) do - vim.api.nvim_set_hl(0, highlight[1], highlight[2]) - end - end -} diff --git a/nvim/lua/vim_opt.lua b/nvim/lua/vim_opt.lua index 56440a7..80c2924 100644 --- a/nvim/lua/vim_opt.lua +++ b/nvim/lua/vim_opt.lua @@ -22,7 +22,7 @@ opt.softtabstop = 4 opt.shortmess:append("sI") -- Signcolumn -opt.signcolumn = "yes:2" -- Adds a spacing to the left which can contain gutter icons +opt.signcolumn = "yes:1" -- Adds a spacing to the left which can contain gutter icons opt.fillchars = { eob = " " } -- Remove the fill character for empty lines which defaults to: "~" -- Search @@ -66,8 +66,6 @@ opt.termsync = true opt.scrolloff = 4 -- Whitespaces --- opt.listchars = { tab = "→\"", trail = "·", nbsp = "␣" } --- opt.list = true opt.list = false return opt