diff options
author | Sidhanth Rathod <siduck@tutanota.com> | 2022-08-07 18:35:48 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-07 18:35:48 +0530 |
commit | d2a51bbf8b1bf07887e26900b4804ae070743926 (patch) | |
tree | 022f2b2178643b4c690b26d283f385df35024d97 | |
parent | Merge pull request #7 from sitiom/patch-1 (diff) | |
parent | fix: Clear the highlight cache on 'ColorScheme' event. (diff) |
Merge pull request #3 from sindrets/fix/clear-hl-cache
fix: Clear the highlight cache on 'ColorScheme' event.
-rw-r--r-- | lua/colorizer.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lua/colorizer.lua b/lua/colorizer.lua index f24c792..becc3e2 100644 --- a/lua/colorizer.lua +++ b/lua/colorizer.lua @@ -776,6 +776,7 @@ local function setup(filetypes, user_default_options) end end end + nvim.ex.autocmd("ColorScheme", "*", "lua require('colorizer').clear_highlight_cache()") nvim.ex.augroup "END" end @@ -786,6 +787,12 @@ local function reload_all_buffers() end end +--- Clear the highlight cache and reload all buffers. +local function clear_highlight_cache() + HIGHLIGHT_CACHE = {} + vim.schedule(reload_all_buffers) +end + --- Return the currently active buffer options. -- @tparam[opt=0|nil] integer buf A value of 0 or nil implies the current buffer. local function get_buffer_options(buf) @@ -805,4 +812,5 @@ return { highlight_buffer = highlight_buffer, reload_all_buffers = reload_all_buffers, get_buffer_options = get_buffer_options, + clear_highlight_cache = clear_highlight_cache, } |