I got this regexp from google which is for matching specific glyphs in vim-nerdtree.

autocmd FileType nerdtree syntax match {hl-group} /\v{glyph}/ containedin=ALL

But obviously it won't work on custom statusline/tabline. What events should I use for it to work?

The :syntax command only covers actual buffer contents. Both statusline and (terminal) tabline, though displayed with the same font and highlighting possibilities as the windows that contain buffer contents, are different: They belong to the editor UI elements.

The main reason for syntax highlighting is highlighting parts of the text with different colors or text attributes, through highlight groups. For the tabline, there's a fixed set of highlight groups (:help setting-tabline), for the statuslines there are two different groups for active and inactive (:help hl-StatusLine). Inside both, you can include 9 different user highlightings via the %1*...%* items, cp. :help hl-User1..9.

You cannot use this for concealing characters, but this can be done by including a custom Vimscript expression (%{...}) and translating / removing the characters in there.

  • For the tabline, you can use the full highlighting options as for the statusline, if you use a text based tabline (e.g. :set guioptions-=e) – Christian Brabandt yesterday
  • Thanks @ChristianBrabandt, I had missed that! Nice that this actually is consistent; I've adapted my answer. – Ingo Karkat yesterday
  • I forgot to mention I'm using terminal vim – John Fred Fadrigalan 22 hours ago
  • @JohnFredFadrigalan: That's already considered by the answer. – Ingo Karkat 20 hours ago

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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