2023-04-22 17:26:08 +02:00
|
|
|
;; Hover-Highlights
|
|
|
|
(fn on-lsp-attach [args]
|
|
|
|
(local buf args.buf)
|
|
|
|
(local client (vim.lsp.get_client_by_id args.data.client_id))
|
2023-06-27 22:30:06 +02:00
|
|
|
(when (and client.server_capabilities.documentHighlightProvider
|
|
|
|
(not vim.b.mzte_reg_hl_aucmd))
|
|
|
|
(set vim.b.mzte_reg_hl_aucmd true)
|
2023-04-22 17:26:08 +02:00
|
|
|
;; Symbol highlighting
|
|
|
|
(vim.api.nvim_create_autocmd :CursorHold
|
2023-04-23 18:07:38 +02:00
|
|
|
{:buffer buf
|
2023-05-13 12:42:35 +02:00
|
|
|
:callback #(pcall vim.lsp.buf.document_highlight)})
|
2023-04-22 17:26:08 +02:00
|
|
|
(vim.api.nvim_create_autocmd :CursorMoved
|
2023-04-23 18:07:38 +02:00
|
|
|
{:buffer buf
|
2023-07-01 21:29:14 +02:00
|
|
|
:callback #(vim.lsp.buf.clear_references)})))
|
2023-04-22 17:26:08 +02:00
|
|
|
|
|
|
|
(vim.api.nvim_create_autocmd :LspAttach {:callback on-lsp-attach})
|
|
|
|
|
|
|
|
;; Highlight in bold font
|
|
|
|
(local hlgroups [:LspReferenceText :LspReferenceRead :LspReferenceWrite])
|
|
|
|
(each [_ hl (ipairs hlgroups)]
|
2023-04-23 18:07:38 +02:00
|
|
|
(vim.api.nvim_set_hl 0 hl {:bold true :bg "#6272a4"}))
|