File tree Expand file tree Collapse file tree 5 files changed +17
-37
lines changed Expand file tree Collapse file tree 5 files changed +17
-37
lines changed Original file line number Diff line number Diff line change @@ -415,8 +415,6 @@ Provides configuration options and utilities for setting up colorizer.
415415LUA API *colorizer.config-lua-api*
416416
417417Functions: ~
418- | reset_cache | - Reset the cache for buffer options.
419-
420418 | set_bo_value | - Set options for a specific buffer or file type.
421419
422420 | apply_alias_options | - Parse and apply alias options to the user options.
@@ -436,14 +434,6 @@ Tables: ~
436434 | ud_opts | - Configuration options for the `setup` function.
437435
438436
439- reset_cache() *colorizer.config.reset_cache*
440- Reset the cache for buffer options.
441-
442- Called from colorizer.setup
443-
444-
445-
446-
447437set_bo_value({bo_type}, {val} , {ud_opts}) *colorizer.config.set_bo_value*
448438 Set options for a specific buffer or file type.
449439
Original file line number Diff line number Diff line change @@ -69,10 +69,6 @@ <h1>Module <code>colorizer.config</code></h1>
6969
7070< h2 > < a href ="#Functions "> Functions</ a > </ h2 >
7171< table class ="function_list ">
72- < tr >
73- < td class ="name " nowrap > < a href ="#reset_cache "> reset_cache ()</ a > </ td >
74- < td class ="summary "> Reset the cache for buffer options.</ td >
75- </ tr >
7672 < tr >
7773 < td class ="name " nowrap > < a href ="#set_bo_value "> set_bo_value (bo_type, val, ud_opts)</ a > </ td >
7874 < td class ="summary "> Set options for a specific buffer or file type.</ td >
@@ -117,21 +113,6 @@ <h2><a href="#Tables">Tables</a></h2>
117113 < h2 class ="section-header "> < a name ="Functions "> </ a > Functions</ h2 >
118114
119115 < dl class ="function ">
120- < dt >
121- < a name = "reset_cache "> </ a >
122- < strong > reset_cache ()</ strong >
123- </ dt >
124- < dd >
125- Reset the cache for buffer options.
126- Called from colorizer.setup
127-
128-
129-
130-
131-
132-
133-
134- </ dd >
135116 < dt >
136117 < a name = "set_bo_value "> </ a >
137118 < strong > set_bo_value (bo_type, val, ud_opts)</ strong >
Original file line number Diff line number Diff line change @@ -253,7 +253,10 @@ function M.reload_on_save(pattern)
253253 colorizer_state .buffer_reload = buffer_reload
254254
255255 vim .schedule (function ()
256- M .attach_to_buffer ()
256+ -- mimic bo_type_setup() function within colorizer.setup
257+ local bo_type = " filetype"
258+ local ud_opts = config .get_bo_options (bo_type , vim .bo .buftype , vim .bo .filetype )
259+ M .attach_to_buffer (evt .buf , ud_opts , bo_type )
257260 vim .notify (
258261 " Colorizer reloaded with updated options from " .. evt .match ,
259262 vim .log .levels .INFO
@@ -461,12 +464,11 @@ function M.setup(opts)
461464 require (" colorizer.matcher" ).reset_cache ()
462465 require (" colorizer.parser.names" ).reset_cache ()
463466 require (" colorizer.buffer" ).reset_cache ()
464- require (" colorizer.config" ).reset_cache ()
465467
466468 local s = config .get_setup_options (opts )
467469
468470 -- Setup the buffer with the correct options
469- local function setup (bo_type )
471+ local function bo_type_setup (bo_type )
470472 local filetype = vim .bo .filetype
471473 local buftype = vim .bo .buftype
472474 local bufnr = utils .bufme ()
@@ -532,10 +534,10 @@ function M.setup(opts)
532534 callback = function ()
533535 if s .lazy_load then
534536 vim .schedule (function ()
535- setup (bo_type )
537+ bo_type_setup (bo_type )
536538 end )
537539 else
538- setup (bo_type )
540+ bo_type_setup (bo_type )
539541 end
540542 end ,
541543 })
Original file line number Diff line number Diff line change 9898local options_cache
9999--- Reset the cache for buffer options.
100100-- Called from colorizer.setup
101- function M . reset_cache ()
101+ local function init_cache ()
102102 options_cache = { buftype = {}, filetype = {} }
103103end
104+
105+ local function init_config ()
106+ init_options ()
107+ init_cache ()
108+ end
104109do
105- M . reset_cache ()
110+ init_config ()
106111end
107112
108113--- Validate user options and set defaults.
251256--- @param opts table | nil : Configuration options for colorizer.
252257--- @return table : Final settings after merging user and default options.
253258function M .get_setup_options (opts )
254- init_options ()
259+ init_config ()
255260 opts = opts or {}
256261 opts .user_default_options = opts .user_default_options or plugin_user_default_options
257262 opts .user_default_options = M .apply_alias_options (opts .user_default_options )
Original file line number Diff line number Diff line change @@ -82,10 +82,12 @@ DeepSkyBlue DeepSkyBlue2
8282DEEPSKYBLUE DEEPSKYBLUE3
8383
8484Extra names:
85+ From function defined in `user_default_options`
8586 oniViolet oniViolet2 crystalBlue springViolet1 springViolet2 springBlue
8687 lightBlue waveAqua2
8788
8889Custom names with non-alphanumeric characters:
90+ From table in filetype definiton (lua)
8991 one_two three=four five@six seven!eight nine!!ten
9092 NOTE: TODO: WARN: FIX: .
9193 NOTE:
You can’t perform that action at this time.
0 commit comments