1

I've customized a colour scheme over the decades. Recently (possibly within the last year), I upgraded BufExplorer and found that it lists all of the buffers in mostly orange or yellow. Orange is my colour for comments while yellow is for strings.

How does BufExplorer decide which buffers in the buffer list use which colours? BufExplorer.vim's "function! s:SetupSyntax()" contains the following:

hi def link bufExplorerActBuf Identifier
hi def link bufExplorerAltBuf String
hi def link bufExplorerCurBuf Type
hi def link bufExplorerHidBuf Constant
hi def link bufExplorerLockedBuf Special
hi def link bufExplorerModBuf Exception
hi def link bufExplorerUnlBuf Comment
hi def link bufExplorerInactBuf Comment

The image of BufExplorer was split-opened when ~/tmp/tmp.c was the current window. Active buffers (#144, #101, #8, and #2) are supposed to show up with the colour of strings (yellow), but in the buffer list, buffers #101, #8, and #2 show up as cyan while buffer #144 (the current window when BufExplorer was split-opened) shows up as a comment (orange). According to the VimScript highlighting commands above, comment colouring is for Unloaded and Inactive buffers, which is not applicable to #144. Furthermore, buffers #6, #108, and #114 show up in orange comment colour when they have no indicators beside them.

enter image description here

One thing that does make sense is that hidden buffers #113 and #107 show up as yellow for constants. But the rest of the above is puzzling.

How can I understand the colouring and control it?

1 Answer 1

1

You can verify the highlighting group used by BufExplorer moving your cursor to the buffer you want and running the following Vim command:

echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')

You can check the color definition of a special highlighting group with the following command:

verbose hi bufExplorerCurBuf

That returns:

bufExplorerCurBuf xxx links to Type

Then following the links:

verbose hi Type

Which return on my version (using the Nord colorscheme)

Type           xxx term=underline ctermfg=4 guifg=#81A1C1

If you don't like the color you can change them:

hi bufExplorerCurBuf term=underline guifg=green
5
  • 1
    Thanks, Vivian. I apologize, but it may be some time before I try this, but I will close the loop. Commented Mar 17, 2023 at 17:21
  • You are welcome! Take your time :-) Commented Mar 17, 2023 at 17:52
  • 1
    Thank you again, Vivian. I just confirmed that your very 1st command above will return different mappings (as listed in my originally posted question) depending on the buffer that the cursor is on. I won't try to decipher the command, as my VimScript is very rudimentary. I appreciate the recipe that you posted for customizing the highlighting for BufExplorer groups. Commented Mar 18, 2023 at 17:54
  • Thanks for the feedback :-) Commented Mar 18, 2023 at 18:50
  • 1
    For anyone else who has a hard time adjusting to new things after decades of making an old thing work well in their workflow, I found it helpful to map all the BufExplorer highlighting groups to "Normal". I find that when I constantly create new tabs and subwindows on the fly in order to cruise through various information sources, I really don't need an instant colour differentiation of the state of each buffer, and sometimes having to squint and crane my neck to see the text. On the odd occassions when I want to know the buffer state, I can look up the 1-character indicators. Commented Mar 20, 2023 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.