From ba29e7305b4b2256fb87f46c4a5bb9e87f54d0c3 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Sat, 22 Apr 2023 17:26:08 +0200 Subject: [PATCH] mzte-nv: add LSP hover highlights --- mzte-nv/conf/init.fnl | 1 + mzte-nv/conf/lua/lsp.fnl | 20 ++++++++++++++++++++ mzte-nv/conf/lua/pluginconf/p-lspconf.fnl | 1 + mzte-nv/conf/lua/settings.fnl | 3 +++ 4 files changed, 25 insertions(+) create mode 100644 mzte-nv/conf/lua/lsp.fnl diff --git a/mzte-nv/conf/init.fnl b/mzte-nv/conf/init.fnl index 94a193a..b6c0e88 100644 --- a/mzte-nv/conf/init.fnl +++ b/mzte-nv/conf/init.fnl @@ -3,5 +3,6 @@ (require :settings) (require :plugins) (require :maps) +(require :lsp) (require :neovide) (require :pipe) diff --git a/mzte-nv/conf/lua/lsp.fnl b/mzte-nv/conf/lua/lsp.fnl new file mode 100644 index 0000000..8287cf9 --- /dev/null +++ b/mzte-nv/conf/lua/lsp.fnl @@ -0,0 +1,20 @@ +;; Hover-Highlights +(fn on-lsp-attach [args] + (local buf args.buf) + (local client (vim.lsp.get_client_by_id args.data.client_id)) + (when client.server_capabilities.documentHighlightProvider + ;; Symbol highlighting + (vim.api.nvim_create_autocmd :CursorHold + {:callback vim.lsp.buf.document_highlight}) + (vim.api.nvim_create_autocmd :CursorHoldI + {:callback vim.lsp.buf.document_highlight}) + (vim.api.nvim_create_autocmd :CursorMoved + {:callback vim.lsp.buf.clear_references}))) + +(vim.api.nvim_create_autocmd :LspAttach {:callback on-lsp-attach}) + +;; Highlight in bold font +(local hlgroups [:LspReferenceText :LspReferenceRead :LspReferenceWrite]) +(each [_ hl (ipairs hlgroups)] + (vim.api.nvim_set_hl 0 hl {:bold true + :bg "#6272a4"})) diff --git a/mzte-nv/conf/lua/pluginconf/p-lspconf.fnl b/mzte-nv/conf/lua/pluginconf/p-lspconf.fnl index 3023a38..f73e571 100644 --- a/mzte-nv/conf/lua/pluginconf/p-lspconf.fnl +++ b/mzte-nv/conf/lua/pluginconf/p-lspconf.fnl @@ -27,6 +27,7 @@ (setup :clangd {:on_attach (fn [c b] (disable-formatter c b) (check-conjure c b))}) + (setup :cssls) (setup :elixirls {:cmd [:elixir-ls]}) (setup :eslint) diff --git a/mzte-nv/conf/lua/settings.fnl b/mzte-nv/conf/lua/settings.fnl index 653379c..07b7078 100644 --- a/mzte-nv/conf/lua/settings.fnl +++ b/mzte-nv/conf/lua/settings.fnl @@ -7,6 +7,9 @@ (cmd "syntax on") +;; Quicker updatetime +(set opt.updatetime 1000) + ;; Indentation (set opt.tabstop 4) (set opt.shiftwidth 4)