Skip to content

Commit

Permalink
fix: add support for Neovim v0.7+
Browse files Browse the repository at this point in the history
Co-authored-by: Lukas Reineke <[email protected]>
  • Loading branch information
mehalter and lukas-reineke committed Oct 2, 2023
1 parent 2ec42d2 commit 8b3dee4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lua/ibl/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ local M = {
}

local get = function(name)
return vim.api.nvim_get_hl(0, { name = name })
local hl
if vim.api.nvim_get_hl then -- check for new neovim 0.9 API
hl = vim.api.nvim_get_hl(0, { name = name })
else
---@diagnostic disable-next-line
hl = vim.api.nvim_get_hl_by_name(name, true)
end
return hl
end

local not_set = function(hl)
Expand Down Expand Up @@ -44,7 +51,7 @@ M.setup = function()
local config = conf.get_config(-1)

for _, fn in
pairs(hooks.get(-1, hooks.type.HIGHLIGHT_SETUP) --[[ @as ibl.hooks.cb.highlight_setup[] ]])
pairs(hooks.get(-1, hooks.type.HIGHLIGHT_SETUP) --[[ @as ibl.hooks.cb.highlight_setup[] ]])
do
fn()
end
Expand Down

0 comments on commit 8b3dee4

Please sign in to comment.