From 63e24b3565fbd6a949a4528a8674e8ebdca333f8 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 12 Sep 2022 11:51:35 +0200 Subject: [PATCH] fix: create only one autocmd for sidebars --- lua/tokyonight/util.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lua/tokyonight/util.lua b/lua/tokyonight/util.lua index 151a5c8..5afcd23 100644 --- a/lua/tokyonight/util.lua +++ b/lua/tokyonight/util.lua @@ -81,12 +81,14 @@ function M.autocmds(config) vim.cmd([[augroup TokyoNight]]) vim.cmd([[ autocmd!]]) vim.cmd([[ autocmd ColorScheme * lua require("tokyonight.util").onColorScheme()]]) - for _, sidebar in ipairs(config.sidebars) do - if sidebar == "terminal" then - vim.cmd([[ autocmd TermOpen * setlocal winhighlight=Normal:NormalSB,SignColumn:SignColumnSB]]) - else - vim.cmd([[ autocmd FileType ]] .. sidebar .. [[ setlocal winhighlight=Normal:NormalSB,SignColumn:SignColumnSB]]) - end + + vim.cmd( + [[ autocmd FileType ]] + .. table.concat(config.sidebars, ",") + .. [[ setlocal winhighlight=Normal:NormalSB,SignColumn:SignColumnSB]] + ) + if vim.tbl_contains(config.sidebars, "terminal") then + vim.cmd([[ autocmd TermOpen * setlocal winhighlight=Normal:NormalSB,SignColumn:SignColumnSB]]) end vim.cmd([[augroup end]]) end