File tree 5 files changed +17
-37
lines changed
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.
415
415
LUA API *colorizer.config-lua-api*
416
416
417
417
Functions: ~
418
- | reset_cache | - Reset the cache for buffer options.
419
-
420
418
| set_bo_value | - Set options for a specific buffer or file type.
421
419
422
420
| apply_alias_options | - Parse and apply alias options to the user options.
@@ -436,14 +434,6 @@ Tables: ~
436
434
| ud_opts | - Configuration options for the `setup` function.
437
435
438
436
439
- reset_cache() *colorizer.config.reset_cache*
440
- Reset the cache for buffer options.
441
-
442
- Called from colorizer.setup
443
-
444
-
445
-
446
-
447
437
set_bo_value({bo_type}, {val} , {ud_opts}) *colorizer.config.set_bo_value*
448
438
Set options for a specific buffer or file type.
449
439
Original file line number Diff line number Diff line change @@ -69,10 +69,6 @@ <h1>Module <code>colorizer.config</code></h1>
69
69
70
70
< h2 > < a href ="#Functions "> Functions</ a > </ h2 >
71
71
< 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 >
76
72
< tr >
77
73
< td class ="name " nowrap > < a href ="#set_bo_value "> set_bo_value (bo_type, val, ud_opts)</ a > </ td >
78
74
< td class ="summary "> Set options for a specific buffer or file type.</ td >
@@ -117,21 +113,6 @@ <h2><a href="#Tables">Tables</a></h2>
117
113
< h2 class ="section-header "> < a name ="Functions "> </ a > Functions</ h2 >
118
114
119
115
< 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 >
135
116
< dt >
136
117
< a name = "set_bo_value "> </ a >
137
118
< 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)
253
253
colorizer_state .buffer_reload = buffer_reload
254
254
255
255
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 )
257
260
vim .notify (
258
261
" Colorizer reloaded with updated options from " .. evt .match ,
259
262
vim .log .levels .INFO
@@ -461,12 +464,11 @@ function M.setup(opts)
461
464
require (" colorizer.matcher" ).reset_cache ()
462
465
require (" colorizer.parser.names" ).reset_cache ()
463
466
require (" colorizer.buffer" ).reset_cache ()
464
- require (" colorizer.config" ).reset_cache ()
465
467
466
468
local s = config .get_setup_options (opts )
467
469
468
470
-- Setup the buffer with the correct options
469
- local function setup (bo_type )
471
+ local function bo_type_setup (bo_type )
470
472
local filetype = vim .bo .filetype
471
473
local buftype = vim .bo .buftype
472
474
local bufnr = utils .bufme ()
@@ -532,10 +534,10 @@ function M.setup(opts)
532
534
callback = function ()
533
535
if s .lazy_load then
534
536
vim .schedule (function ()
535
- setup (bo_type )
537
+ bo_type_setup (bo_type )
536
538
end )
537
539
else
538
- setup (bo_type )
540
+ bo_type_setup (bo_type )
539
541
end
540
542
end ,
541
543
})
Original file line number Diff line number Diff line change 98
98
local options_cache
99
99
--- Reset the cache for buffer options.
100
100
-- Called from colorizer.setup
101
- function M . reset_cache ()
101
+ local function init_cache ()
102
102
options_cache = { buftype = {}, filetype = {} }
103
103
end
104
+
105
+ local function init_config ()
106
+ init_options ()
107
+ init_cache ()
108
+ end
104
109
do
105
- M . reset_cache ()
110
+ init_config ()
106
111
end
107
112
108
113
--- Validate user options and set defaults.
251
256
--- @param opts table | nil : Configuration options for colorizer.
252
257
--- @return table : Final settings after merging user and default options.
253
258
function M .get_setup_options (opts )
254
- init_options ()
259
+ init_config ()
255
260
opts = opts or {}
256
261
opts .user_default_options = opts .user_default_options or plugin_user_default_options
257
262
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
82
82
DEEPSKYBLUE DEEPSKYBLUE3
83
83
84
84
Extra names:
85
+ From function defined in `user_default_options`
85
86
oniViolet oniViolet2 crystalBlue springViolet1 springViolet2 springBlue
86
87
lightBlue waveAqua2
87
88
88
89
Custom names with non-alphanumeric characters:
90
+ From table in filetype definiton (lua)
89
91
one_two three=four five@six seven!eight nine!!ten
90
92
NOTE: TODO: WARN: FIX: .
91
93
NOTE:
You can’t perform that action at this time.
0 commit comments