Skip to content

Commit

Permalink
Use nvim_buf_set_extmark to allow 'combine' hl_mode
Browse files Browse the repository at this point in the history
`nvim_buf_clear_namespace` does not allow to set the hl_mode, which
causes problems with cursorlines, as the virtual text doesn't get the
cursorline background. Using extmark we can pass `hl_mode = 'combine'`,
which addresses exactlt that.
  • Loading branch information
alvarosevilla95 committed Oct 31, 2021
1 parent f2b266f commit bc41c44
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lua/nvim-biscuits/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@ nvim_biscuits.decorate_nodes = function(bufnr, lang)
vim.api.nvim_buf_clear_namespace(bufnr,
biscuit_highlight_group,
end_line, end_line + 1)
vim.api.nvim_buf_set_virtual_text(bufnr,
biscuit_highlight_group,
end_line, {
{text, biscuit_highlight_group_name}
}, {})
vim.api.nvim_buf_set_extmark(bufnr, biscuit_highlight_group, end_line, 0, {
virt_text_pos = "eol",
virt_text = {
{text, biscuit_highlight_group_name}
},
hl_mode = "combine"
})
end
end

Expand Down

0 comments on commit bc41c44

Please sign in to comment.