Skip to content

Commit

Permalink
fix(colorscheme): don't set theme on win with theme already set (#13)
Browse files Browse the repository at this point in the history
if a plugin - e.g. levouh/tint.nvim - changes a windows hl_ns on
WinLeave, styler overwrites these changes.

WinLeave - tint sets new hl_ns
WinNew - styler sets hl_ns on all windows containing the buffer of new
window overwriting the changes on WinLeave

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
  • Loading branch information
sheimer and folke authored Jul 6, 2024
1 parent ad297d4 commit 7005fa7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/styler/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ M.bufs = {}
function M.set_theme(win, theme)
win = win == 0 and vim.api.nvim_get_current_win() or win

if vim.w[win].theme and vim.w[win].theme.colorscheme == theme.colorscheme then
return
end

vim.w[win].theme = theme
local ns = require("styler.theme").load(theme)
vim.api.nvim_win_set_hl_ns(win, ns)
Expand Down

0 comments on commit 7005fa7

Please sign in to comment.