Skip to content

Commit

Permalink
fix(syntax-hl): set nocombine on Comment
Browse files Browse the repository at this point in the history
For `Comment`, don't inherit style attributes (e.g. bold, italic) from
other (e.g. overlayed) hl groups. For example, an inline-comment
appearing after a markdown heading in a markdown file (heading
highlighting extends to the end of the text line, including comments)
can become/display bold due to inheriting style attributes. `nocombine`
keeps this from happening.
  • Loading branch information
tmillr committed Sep 6, 2023
1 parent 58d3d58 commit ac071e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lua/github-theme/group/syntax.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function M.get(spec, config)
-- (1) add Commented style settings in config module
-- stylua: ignore
return {
Comment = { fg = syn.comment, style = stl.comments }, -- any comment
Comment = { fg = syn.comment, style = stl.comments, nocombine = true }, -- any comment
Constant = { fg = syn.const, style = stl.constants }, -- (preferred) any constant
String = { fg = syn.string, style = stl.strings }, -- a string constant: 'this is a string'
Character = { link = 'String' }, -- a character constant: 'c', '\n'
Expand Down
3 changes: 3 additions & 0 deletions lua/github-theme/lib/compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ vim.o.background = "%s"
op.fg = values.fg
op.sp = values.sp
op.blend = values.blend
if op.nocombine == nil then
op.nocombine = values.nocombine
end
table.insert(lines, fmt([[h(0, "%s", %s)]], name, inspect(op)))
end
end
Expand Down

0 comments on commit ac071e0

Please sign in to comment.