Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different colors for folds and subfolds in Vim

Tags:

vim

folding

Is it possible to have different set of colors for folds and subfolds, eg:

  • blue foreground on grey background for fold level 1 (default)
  • black foreground on dark yellow background for fold level 2
  • etc... (although going further down would seem a bit excessive)
like image 410
ThG Avatar asked Oct 14 '10 06:10

ThG


People also ask

How do I change the color scheme in vim?

You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.

Where do vim color schemes go?

You can find those color schemes in the /usr/share/vim/vim*/colors directory as . vim extension.

What are vim color schemes?

Vim color schemes are a useful feature of this popular text editor. Not only do they allow for practical syntax highlighting, but they also give users a chance to personalize the interface. As a Vim user, you can change color schemes that come with the software package or install user-made color schemes.

How do I change the color of a folder in Linux?

The values have 2 or more parts separated by semicolon (;). For example, di=0;34, here di means the color should be applied to directories. 0 means it's a normal color, and 34 means the color is green. If you want bold green font for the directories, the color code should be di=1;34.


2 Answers

It depends if you are using Gui Vim version or text one. From my side (text version) I have set that in my .vimrc

hi Folded ctermfg=Black
hi Folded ctermbg=DarkGrey
like image 58
Fabien Avatar answered Oct 09 '22 22:10

Fabien


From vim documentation:

COLORS                          *fold-colors*

The colors of a closed fold are set with the Folded group |hl-Folded|.  The
colors of the fold column are set with the FoldColumn group |hl-FoldColumn|.
Example to set the colors: >

        :highlight Folded guibg=grey guifg=blue
        :highlight FoldColumn guibg=darkgrey guifg=white

so you cannot easily do this. The best piece of advice I could give you is to set statusbar to display the current fold level if possible.

like image 20
Benoit Avatar answered Oct 09 '22 21:10

Benoit