rmehri01/onenord.nvim

How to change underline on cursor hold

Closed this issue · 3 comments

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.
Screenshot_2021-12-26_17-54-12

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:

Screen Shot 2021-12-31 at 11 16 48 AM

You could also use bold and/or another highlight color if you want!

Yes, that works! Thank you very much!

No problem!