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) Nov 12 '18 at 10:39
  • Thanks @ChristianBrabandt, I had missed that! Nice that this actually is consistent; I've adapted my answer. Nov 12 '18 at 10:58
  • I forgot to mention I'm using terminal vim Nov 13 '18 at 5:35
  • @JohnFredFadrigalan: That's already considered by the answer. Nov 13 '18 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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