@@ -271,14 +271,24 @@ local function setup_highlights()
271
271
local highlights = {
272
272
SelectaPrefix = { link = " Special" },
273
273
SelectaMatch = { link = " Identifier" }, -- or maybe DiagnosticFloatingOk
274
- -- BUG: only selectafilter cleared when changing colorscheme - drive me crazy
275
- SelectaFilter = { link = " Type" },
274
+ -- SelectaFilter = { link = "Type" },
276
275
SelectaCursor = { blend = 100 , nocombine = true },
277
276
SelectaPrompt = { link = " FloatTitle" },
278
277
SelectaSelected = { link = " Statement" },
279
278
SelectaFooter = { link = " Comment" },
280
- SelectaCurrentLine = { link = M .config .current_highlight .hl_group },
279
+ -- SelectaCurrentLine = { link = M.config.current_highlight.hl_group },
281
280
}
281
+
282
+ -- NOTE: for some wierd reason, this is the only way those 2 highlight groups works
283
+ local current_hl_group = M .config .current_highlight .hl_group
284
+ vim .cmd (string.format (
285
+ [[
286
+ highlight default link SelectaFilter Type
287
+ highlight default link SelectaCurrentLine %s
288
+ ]] ,
289
+ current_hl_group
290
+ ))
291
+
282
292
M .log (" Setting up highlights..." )
283
293
for name , attrs in pairs (highlights ) do
284
294
vim .api .nvim_set_hl (0 , name , attrs )
@@ -1729,18 +1739,15 @@ function M.setup(opts)
1729
1739
setup_highlights ()
1730
1740
end )
1731
1741
1732
- if M .config .current_highlight .enabled then
1733
- vim .api .nvim_set_hl (0 , " SelectaCurrentLine" , {
1734
- link = M .config .current_highlight .hl_group ,
1735
- })
1736
- end
1737
1742
-- Create autocmd for ColorScheme event
1738
1743
M .log (" Creating ColorScheme autocmd" )
1739
1744
vim .api .nvim_create_autocmd (" ColorScheme" , {
1740
1745
group = vim .api .nvim_create_augroup (" SelectaHighlights" , { clear = true }),
1741
1746
callback = function ()
1742
1747
M .log (" ColorScheme autocmd triggered" )
1743
- setup_highlights ()
1748
+ vim .schedule (function ()
1749
+ setup_highlights ()
1750
+ end )
1744
1751
end ,
1745
1752
})
1746
1753
end
0 commit comments