Skip to content

Cursor highlighting lost in highlighted blocks #6

@jay-aye-see-kay

Description

@jay-aye-see-kay

First of all thanks sharing this plugin, I've used it to replace a buggy implementation in my config built using signs instead of extmarks. In my implementation I had this same issue, but I think with extmarks it can be fixed.

Here's an video of the issue, you can see when the CursorLine enters the highlighted area it disappears. I'd guess this is due to the extmarks colour getting a higher priority.

I briefly looked into it and found this thread about that behaviour neovim/neovim#15485 . This suggests it's possible to call nvim_buf_set_extmark with opts.hl_mode to resolve this issue...

Would you be open to changing the default behaviour, or perhaps exposing this an option? If you're busy I should have time to look into this later in the week.

Screen.Recording.2023-02-28.at.4.30.56.pm.mov

Here's my tsnode-marker config (h.autocmd is an internal helper function that autmattically sets augroup)

h.autocmd({ "ColorScheme" }, {
	callback = function()
		-- add hl group for markdown codeblock backgrounds
		vim.api.nvim_set_hl(0, "CodeBlockBackground", { bg = require("zenbones").Normal.bg.li(70).hex })
		-- darken cursorline so it's more visible
		vim.api.nvim_set_hl(0, "CursorLine", { bg = require("zenbones").CursorLine.bg.darken(7).hex })
	end,
})


h.autocmd({ "FileType" }, {
	pattern = { "markdown", "md" },
	callback = function(ctx)
		require("tsnode-marker").set_automark(ctx.buf, {
			target = { "code_fence_content" },
			hl_group = "CodeBlockBackground",
		})
	end,
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions