You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lua/colorizer/config.lua
+15
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,9 @@ local plugin_user_default_options = {
33
33
virtualtext_inline=false,
34
34
virtualtext_mode="foreground",
35
35
always_update=false,
36
+
hooks= {
37
+
disable_line_highlight=false,
38
+
},
36
39
}
37
40
38
41
--[[-- Default user options for colorizer.
@@ -71,6 +74,8 @@ If both `css` and `css_fn` are true, `css_fn` has more priority over `css`.
71
74
-- @field virtualtext_inline boolean|'before'|'after': Shows virtual text inline with color.
72
75
-- @field virtualtext_mode 'background'|'foreground': Mode for virtual text display.
73
76
-- @field always_update boolean: Always update color values, even if buffer is not focused.
77
+
-- @field hooks table: Table of hook functions
78
+
-- @field hooks.disable_line_highlight function: Returns boolean which controls if line should be parsed for highlights
74
79
75
80
--- Options for colorizer that were passed in to setup function
76
81
--@field filetypes
@@ -165,6 +170,11 @@ local function validate_options(ud_opts)
165
170
}
166
171
ud_opts.names_custom=false
167
172
end
173
+
ifud_opts.hooksthen
174
+
iftype(ud_opts.hooks.disable_line_highlight) ~="function" then
175
+
ud_opts.hooks.disable_line_highlight=false
176
+
end
177
+
end
168
178
end
169
179
170
180
--- Set options for a specific buffer or file type.
@@ -242,6 +252,11 @@ end
242
252
-- - `virtualtext_inline` (boolean|'before'|'after'): Shows the virtual text inline with the color. True defaults to 'before'.
243
253
-- - `virtualtext_mode` ('background'|'foreground'): Determines the display mode for virtual text.
244
254
-- - `always_update` (boolean): If true, updates color values even if the buffer is not focused.</pre>
255
+
-- - `hooks` (table): Table of hook functions
256
+
-- - `disable_line_highlight` (function): Returns a boolean that controls if the line should be parsed for highlights. Called with 3 parameters:
257
+
-- - `line` (string): The line's contents.
258
+
-- - `bufnr` (number): The buffer number.
259
+
-- - `line_num` (number): The line number (0-indexed). Add 1 to get the line number in the buffer.
245
260
-- @field buftypes (table|nil): Optional. A list of buffer types where colorizer should be enabled. Defaults to all buffer types if not provided.
246
261
-- @field user_commands (boolean|table): If true, enables all user commands for colorizer. If `false`, disables user commands. Alternatively, provide a table of specific commands to enable:
0 commit comments