Reputation: 941
The default styling for folded headers in Vim's built-in Markdown highlighting is a whitish background, which is very difficult to visually scan.
How can I change the background color of lines that are folded Markdown headers?
Thanks!
Upvotes: 1
Views: 908
Reputation: 693
You can change folded highlight style by setting the Folded
highlight group.
In order to change background colour of a highlight group you need to change ctermbg
(for Terminal Vim) or guibg
(for Gvim).
For example, to change folded background to white:
:highlight Folded ctermbg=15
You can use :hi
instead of the full command name :highlight
.
You need to specify colour number for ctermbg
and list of acceptable values can be found in :h highlight-ctermbg
.
For changing folded backgound colour in GUI Vim (GVim), you need to use guibg
:
:hi Folded guibg=white
You can check list of acceptable values for guibg
here:
:h gui-colors
Using :highlight
(:hi
in abbrev) command in the current session changes highlight settings for the current session only.
It would be recommended to use autocommand
to make it persistent.
augroup MyGroup
autocmd ColorScheme * hi Folded ctermbg=15 guibg=white
augroup END
Additional information
You can put hi Folded ctermbg=15 guibg=white
in your .vimrc
to make background colour of folded lines white.
However, with this, the :hi
command is invoked when you open Vim or .vimrc is reloaded by :source
command.
So your highlight settings will be reset if you change the colorscheme in the session.
With the autocmd
why above, the autocmd is invoked if the ColorScheme
event is fired (= colorscheme is changed).
Upvotes: 2
Reputation: 3258
Using hi [group] ctermbg=[color] guibg=[color]
to change highlighting background for a group.
:h :hi
for more usage.
If you don't know the highlight group name of the folded markdown headers. Run :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
to get text highlight group names under cursor.
Upvotes: 0