In my screenshot, the section headers ("recent branches", "local head", etc.) are visually indistinguishable from the completion suggestions.

compinstall doesn't seem to be able to change the styling.

How can I, for example, set the section headers in bold or invert fg/bg colors?

enter image description here

2 Answers 2


See info zsh format (you may need to install a zsh-doc package or equivalent).

You can set the format zstyle for completions:

zstyle ':completion:*' format '%K{blue}%F{yellow}Completing %d:%k%f'

Would show the completion headers as something like Completing recent branches: in yellow over a blue background.

You'll find it in the compinstall menus under:

3.  Styles for changing the way completions are displayed and inserted.
1.  Change appearance of completion lists:  allows descriptions of
    completions to appear and sorting of different types of completions.
1.  Print a message above completion lists describing what is being
You can set a string which is displayed on a line above the list of matches
for completions.  A `%d' in this string will be replaced by a brief
description of the type of completion.  For example, if you set the
string to `Completing %d', and type ^D to show a list of files, the line
`Completing files' will appear above that list.  Enter an empty line to
turn this feature off.  If you enter something which doesn't include `%d',
then `%d' will be appended.  Quotation will be added automatically.


You'll find that compinstall does set the style as zstyle ':completion:*' format. That sets the format for all kinds of completions (files, directories, filters...). You can also set different styles for different categories (see the first argument passed to _description in grep -rw _descriptions $fpath):

zstyle ':completion:*:*director*' format '%F{blue}%BCompleting %d:%b%f'
zstyle ':completion:*:*file*' format '%F{magenta}%BCompleting %d:%b%f'

# fallback:
zstyle ':completion:*:descriptions' format '%BCompleting %d:%b'

Though you'll find those tags (files, directories...) are not always use consistently by all completers.

  • Thanks. A remark: info zsh format does not work for me, it points to the start page info zsh. Oct 7, 2020 at 21:46
  • 1
    @FelixDombek, you may need to install a zsh-doc package or equivalent. Some systems don't install the doc in info format by default. I've added a link to where info zsh format should take you. You'll find the same information in the man pages, but the man format is really not appropriate for a manual this big IMO. Oct 8, 2020 at 5:51

I found a solution in https://github.com/solnic/dotfiles/blob/master/home/zsh/completion.zsh.

The relevant excerpt is

// needs 'autoload -U colors && colors' 

zstyle ':completion:*:descriptions' format "%{${fg_bold[magenta]}%}= %d =%{$reset_color%}"
  • 1
    You don't need to use the colors function here. You can use the %K{colour}, %F{colour} like in prompt expansion (which allows you to use true-colours (possibly via zsh/nearcolor if your terminal doesn't support true-colour). Oct 8, 2020 at 5:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .