From 10ffa92ad6481f93c9c6aaaef8bc7ac14479f480 Mon Sep 17 00:00:00 2001 From: Robert Morrison Date: Tue, 13 Jun 2023 04:31:26 +0100 Subject: [PATCH] ! NASTY COMMIT ! This commit is here just to shore everything up before embarking on yet another full refresh of the config. This is likely going to be the last commit and it is very important if you are using this repo to check for a hopefully newly created "NIVM" repo. (Note: this may take time, I will archive this repo when I have a working NIVM) --- after/plugin/LSP.lua | 52 +++++++++++++++++++++++++++------- after/plugin/todo-comments.lua | 50 ++++++++++++++++++++++++++++++++ lua/sherlock5512/plugins.lua | 2 ++ 3 files changed, 94 insertions(+), 10 deletions(-) create mode 100644 after/plugin/todo-comments.lua diff --git a/after/plugin/LSP.lua b/after/plugin/LSP.lua index 66f8fbf..11c5df9 100644 --- a/after/plugin/LSP.lua +++ b/after/plugin/LSP.lua @@ -39,7 +39,8 @@ modules["mason-lspconfig"].setup_handlers { ["omnisharp"] = function () modules["lspconfig"]["omnisharp"].setup { capabilities = capabilities, - on_attach = function (_,_) + on_attach = function (client,_) + client.server_capabilities.semanticTokensProvider = nil; local gr = vim.api.nvim_create_augroup("CS-OnAttach",{}) vim.api.nvim_create_autocmd({"BufWritePre"}, { group = gr, @@ -175,20 +176,51 @@ if not ok then return end --- Wrapping since some distros still don't ship nvim 0.8 +-- do some safe config + +local config = { --shared config + code_action = { + num_shortcut = true, + show_server_name = true, + extend_gitsigns = true, + }, + lightbulb = { + enable = true, + enable_in_insert = false, + sign = true, + virtual_text = false, + }, + hover = { + open_browser = '!$BROWSER' + } +} if vim.fn.exists('+winbar') ~= 0 then - lspsaga.setup({ + local add = { symbol_in_winbar = { in_custom = false, enable = true, seperator = '>', show_file = true, click_support = false - }, - diagnostic_header = { " ", " ", " ", "ﴞ " }, - }) -else - lspsaga.setup({ - diagnostic_header = { " ", " ", " ", "ﴞ " }, - }) + } + } + config = vim.tbl_deep_extend('error', config,add) end + +if vim.fn.has('nvim-0.9.0') ~= 0 then + local add = { ui = {title = true} } + config = vim.tbl_deep_extend('error', config,add ) +end +lspsaga.setup(config) + +-- Configure keybinds for lspsaga +local map = vim.keymap.set +map('n','ld', 'Lspsaga hover_doc' ,{desc = '[lspsaga] hoverdoc'}) +map('n','la', 'Lspsaga code_action', {desc = '[lspsaga] codeaction'}) +map('n','lr', 'Lspsaga rename', {desc = '[lspsaga] rename'}) +map('n','lo', 'Lspsaga outline', {desc = '[lspsaga] outline'}) + + +local wk = require('which-key') + +wk.register({ l = {name = "LSP" }},{ prefix = ''}) diff --git a/after/plugin/todo-comments.lua b/after/plugin/todo-comments.lua new file mode 100644 index 0000000..aed456c --- /dev/null +++ b/after/plugin/todo-comments.lua @@ -0,0 +1,50 @@ +local ok, todo_comments = pcall(require,"todo-comments") + +if not ok then + return +end + +todo_comments.setup { + signs = true, + sign_priority = 8, + + keywords= { + FIX = { + icon = "", + color = "error", + alt = {"FIXME", "BUG", "FIXIT", "ISSUE"} + }, + TODO = { icon = "", color = "info"}, + HACK = { icon = "", color = "warning"}, + WARN = { icon = "", color = "warning", alt={"WARNING"}}, + PERF = { icon = "󰓅", alt = {"OPTIM", "PERFORMANCE", "OPTIMISE"}}, + NOTE = { icon = "", color = "hint", alt = {"INFO"}}, + TEST = { icon = "󰤑", color = "test", alt = {"TESTING ", "PASSED", "FAILED"}} + }, + gui_style = { + fg = "NONE", + bg = "NONE" + }, + merge_keywords = true, + + highlight = { + multiline = true, + + before = "", + keyword = "wide", + after = "fg", + + comments_only = true, + max_line_len = 125, + }, + + colors = { + error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, + warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, + info = { "DiagnosticInfo", "#2563EB" }, + hint = { "DiagnosticHint", "#10B981" }, + default = { "Identifier", "#7C3AED" }, + test = { "Identifier", "#FF00FF" } + } + +} diff --git a/lua/sherlock5512/plugins.lua b/lua/sherlock5512/plugins.lua index b8daedc..b017f0a 100644 --- a/lua/sherlock5512/plugins.lua +++ b/lua/sherlock5512/plugins.lua @@ -85,6 +85,8 @@ return require('packer').startup(function(use) use {'j-hui/fidget.nvim'} -- Show LSP status use {'folke/trouble.nvim', -- Show diagnostics in a window requires = {'nvim-tree/nvim-web-devicons'}} + use {'folke/todo-comments.nvim', + requires = {'nvim-lua/plenary.nvim'}} -- DAP use {'jay-babu/mason-nvim-dap.nvim',