How to change underline on cursor hold
Closed this issue · 3 comments
LoydAndrew commented
Hello, thanks for a great plugin. How I can I change underline style when cursor is on hold to just highlight the references?
I have this functions in my config
local function lsp_highlight_document(client)
-- Set autocommands conditional on server_capabilities
if client.resolved_capabilities.document_highlight then
vim.api.nvim_exec(
[[
augroup lsp_document_highlight
autocmd! * <buffer>
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END
]],
false
)
end
end
As a result I want references to be highlighted not underlined.
rmehri01 commented
Hi, glad you like it! It should be simpler than that, I think you can just do the following in your setup function:
custom_highlights = {
-- used for highlighting "text" references
LspReferenceText = { bg = colors.highlight, style = colors.none },
-- used for highlighting "read" references
LspReferenceRead = { bg = colors.highlight, style = colors.none },
-- used for highlighting "write" references
LspReferenceWrite = { bg = colors.highlight, style = colors.none },
},
Which gives me this:
You could also use bold and/or another highlight color if you want!
LoydAndrew commented
Yes, that works! Thank you very much!
rmehri01 commented
No problem!