From 7cac7c82bd59ca3fd493b6bf55cf9fc7488a7b75 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Wed, 20 Mar 2024 18:40:38 +0900 Subject: [PATCH] fix: clear autocmd when loading other colorscheme Problem: When switching the colorscheme from rose-pine to something else, the new colorshceme can be a bit off due to rose-pine's autocmd. Solution: Clear the autocmd. Ideally, it should also reset winhighlight for all windows it touched, but that requires a bit more work. --- lua/rose-pine.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/rose-pine.lua b/lua/rose-pine.lua index 85a39f3..ffdebe0 100644 --- a/lua/rose-pine.lua +++ b/lua/rose-pine.lua @@ -882,9 +882,13 @@ local function set_highlights() -- Support StatusLineTerm & StatusLineTermNC from vim vim.cmd([[ - autocmd TermOpen * if &buftype=='terminal' - \|setlocal winhighlight=StatusLine:StatusLineTerm,StatusLineNC:StatusLineTermNC - \|else|setlocal winhighlight=|endif + augroup rose-pine + autocmd! + autocmd TermOpen * if &buftype=='terminal' + \|setlocal winhighlight=StatusLine:StatusLineTerm,StatusLineNC:StatusLineTermNC + \|else|setlocal winhighlight=|endif + autocmd ColorSchemePre * autocmd! rose-pine + augroup END ]]) end end