gruvbox-material icon indicating copy to clipboard operation
gruvbox-material copied to clipboard

Improve highlights of LaTeX delimiters

Open aloispichler opened this issue 1 year ago • 5 comments

I enjoy dimmed colors for Delimiters (cf. onedark), so brackets etc. distract less. This can be achieved by :hi Delimiter guifg=darkgray

Is there a way to load that directly, something like { 'sainnhe/gruvbox-material', opts={overrides={Delimiter= {link= "Comment"}}}}, ?

aloispichler avatar Aug 30 '23 12:08 aloispichler

Could you please elaborate with an example?

antoineco avatar Aug 30 '23 13:08 antoineco

Customizations can be achieved using an autocmd, like with any (Neo)vim colorscheme. There is an example in the docs, here is another one in Lua:

-- Apply custom highlights on colorscheme change.
-- Must be declared before executing ':colorscheme'.
vim.api.nvim_create_autocmd('ColorScheme', {
  group = vim.api.nvim_create_augroup('gruvbox-material', {}),
  pattern = 'gruvbox-material',
  callback = function()
    vim.api.nvim_set_hl(0, 'Delimiter', { link = 'Comment' })
  end
})

antoineco avatar Aug 30 '23 13:08 antoineco

Thank you, this works indeed! This is my favorite colorscheme for writing LaTeX since years, btw. Let me know if you consider adding a dimmed color for Delimiter. Something between the color of Comment and Whitespace would be nice, I believe.

aloispichler avatar Aug 31 '23 20:08 aloispichler

If LaTeX highlights can be improved while remaining faithful to the semantics of the colorscheme we should definitely do that.

Adding new colors to gruvbox-material is a non-goal, but I'm sure that we can find a sensible defaults that use the existing palette. If not, users are free to customize things however they please. Every individual has different preferences, which is perfectly fine, especially in an editor like (Neo)vim which is designed with customization in mind.

antoineco avatar Aug 31 '23 21:08 antoineco

You are right.

The default colors for Delimiter are: #d4be98 (dark) – 654735 (light), which are fg0 from palette2.

This is what I think is good: #7c6f64 (dark) – a89984 (light), both are grey0 from palette3

This is a very minor, but significant change, as delimiters are very frequent in LaTex: for example in: … let $x=3$ and …. This improves reading a lot.

aloispichler avatar Sep 01 '23 07:09 aloispichler

I didn't have the occasion to open a tex file in Vim and just got back to this issue.

Here is a breakdown of the highlight groups involved:

image

We don't currently have any customization for texDelimiter in the colorscheme, and I agree that grey0 seems like a good candidate.

antoineco avatar Mar 26 '24 21:03 antoineco