Closed wangxuw closed 9 months ago
What Neovim version are you on? nvim_get_hl
was introduced in 0.9
Should we implement backward compatibility or mention the minimum version in README instead? @dhananjaylatkar any thoughts on this?
0.8.0 was released one year ago (Sept 2022). Any reason people are not upgrading?
If this is the only thing not compatible with 0.8.0 then it makes sense to change it.
There are 2 ways I can see -
nvim_set_hl()
all the time.
Con: Too many calls to nvim_set_set()
plugin/gitblame.vim
and then overwrite it in require("gitblame").setup()
.
This will give priority to lua config which should be okay since people won't be doing config using vimscript and lua. 2nd option is not working. Overwrite is not happening.
We can go with 1 or following workaround -
diff --git a/lua/gitblame/init.lua b/lua/gitblame/init.lua
index c73e8a4..a6ed38d 100644
--- a/lua/gitblame/init.lua
+++ b/lua/gitblame/init.lua
@@ -305,14 +305,10 @@ local function update_blame_text(blame_text)
local should_display_virtual_text = vim.g.gitblame_display_virtual_text == 1
- if #vim.api.nvim_get_hl(0, { name = "gitblame" }) == 0 then
- vim.api.nvim_set_hl(0, "gitblame", { link = vim.g.gitblame_highlight_group })
- end
-
if should_display_virtual_text then
local options = {
id = 1,
- virt_text = { { blame_text, "gitblame" } },
+ virt_text = { { blame_text, vim.g.gitblame_highlight_group } },
virt_text_win_col = virt_text_column,
}
local user_options = vim.g.gitblame_set_extmark_options or {}
@dhananjaylatkar I actually like this 🤔 Let me use that instead
neovim version:0.8.0 lunarvim: v1.2
install this plugin using Packer
error msg:
The latest commit adds init.lua:308 and this error encountered.
I am not familiar with lua, but I wonder if this error is related to the '#'?