Skip to content

Commit 65bbc52

Browse files
authored
fix: highlight not modifiable (s1n7ax#27)
* use nvim api to set hl * don't re-create highlight groups on every window pick * use uniform api reference for hl api - Changes to before add hl variable to use the api variable like the rest of the plugin does.
1 parent 5902827 commit 65bbc52

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lua/window-picker/init.lua

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,6 @@ function M.pick_window(custom_config)
124124
local laststatus = v.o.laststatus
125125
local cmdheight = v.o.cmdheight
126126

127-
-- setting highlight groups
128-
-- NOTE: somethig clears out the highlights so this needs to be in pick
129-
-- window function
130-
v.cmd(('highlight NvimWindoSwitch gui=bold guifg=%s guibg=%s'):format(conf.fg_color, conf.current_win_hl_color))
131-
v.cmd(('highlight NvimWindoSwitchNC gui=bold guifg=%s guibg=%s'):format(conf.fg_color, conf.other_win_hl_color))
132-
133127
local selectable = nil
134128

135129
if conf.filter_func then
@@ -238,6 +232,9 @@ function M.setup(custom_config)
238232
config = v.tbl_deep_extend('force', config, custom_config)
239233
end
240234

235+
api.nvim_set_hl(0, 'NvimWindoSwitch', { fg = config.fg_color, bg = config.current_win_hl_color, bold = true })
236+
api.nvim_set_hl(0, 'NvimWindoSwitchNC', { fg = config.fg_color, bg = config.other_win_hl_color, bold = true })
237+
241238
M.setup_completed = true
242239
end
243240

0 commit comments

Comments
 (0)