Skip to content

Commit

Permalink
Make cache_func work with auto_event table
Browse files Browse the repository at this point in the history
  • Loading branch information
UnderCooled authored and windwp committed Nov 2, 2022
1 parent be7184c commit 241fa49
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lua/windline/cache_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ local function cache_func(auto_event, variable_name, action, loading_action, vim
end
if d_check[variable_name] == nil then
d_check[variable_name] = false
local target = auto_event:match('User') and '' or '*'
local target = '*'
if type(auto_event) == 'string' then
target = auto_event:match('User') and ''
else
for _, ev in ipairs(auto_event) do
if ev:match('User') then
target = ''
break
end
end
end
api.nvim_create_autocmd(auto_event, {
group = api.nvim_create_augroup('WL' .. variable_name, { clear = true }),
pattern = target,
Expand Down

0 comments on commit 241fa49

Please sign in to comment.