Skip to content

Commit

Permalink
fix: only use old hl groups when they exist (Fixes #49)
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 14, 2021
1 parent 4cf8740 commit d4ce76f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lua/trouble/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ local links = {
SignInformation = "LspDiagnosticsSignInformation",
SignHint = "LspDiagnosticsSignHint",
TextError = "LspTroubleText",
TextWarning = "LspTroubleText",
TextInformation = "LspTroubleText",
TextHint = "LspTroubleText",
TextWarning = "TroubleText",
TextInformation = "TroubleText",
TextHint = "TroubleText",
Text = "Normal",
File = "Directory",
Source = "Comment",
Expand All @@ -23,13 +23,16 @@ local links = {
Count = "TabLineSel",
Preview = "Search",
Indent = "LineNr",
SignOther = "LspTroubleSignInformation",
SignOther = "TroubleSignInformation",
}

function M.setup()
for k, v in pairs(links) do
vim.api.nvim_command("hi def link LspTrouble" .. k .. " " .. v)
vim.api.nvim_command("hi def link Trouble" .. k .. " LspTrouble" .. k)
if vim.fn.hlexists("LspTrouble" .. k) == 1 then
vim.api.nvim_command("hi def link Trouble" .. k .. " LspTrouble" .. k)
else
vim.api.nvim_command("hi def link Trouble" .. k .. " " .. v)
end
end
end

Expand Down

0 comments on commit d4ce76f

Please sign in to comment.