mirror of
https://github.com/gosticks/bookmarks.nvim.git
synced 2026-04-18 18:44:28 +00:00
34 lines
770 B
Lua
34 lines
770 B
Lua
local api = vim.api
|
|
local nvim = require "bookmarks.nvim"
|
|
|
|
local M = {}
|
|
|
|
local hls = {
|
|
{ BookMarksAdd = { "MarkAdd" } },
|
|
{ BookMarksAnn = { "MarkAnn" } },
|
|
}
|
|
|
|
local function is_hl_set(hl_name)
|
|
local exists, hl = pcall(api.nvim_get_hl_by_name, hl_name, true)
|
|
local color = hl.foreground or hl.background or hl.reverse
|
|
return exists and color ~= nil
|
|
end
|
|
|
|
M.setup_highlights = function()
|
|
for _, hlg in ipairs(hls) do
|
|
for hl, candidates in pairs(hlg) do
|
|
if is_hl_set(hl) then
|
|
else
|
|
for _, d in ipairs(candidates) do
|
|
if is_hl_set(d) then
|
|
nvim.highlight(hl, { default = true, link = d })
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
return M
|