Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How set set multiple color columns / cc (:set colorcolumn) in vim?

Tags:

vim

vi

A single colorcolumn can be set like this:

:set colorcolumn=80

How can I set multiple colorcolumns (e.g., at columns 40 and 80)?

like image 672
Rob Bednark Avatar asked May 13 '18 14:05

Rob Bednark


People also ask

How do I change the color of a column in vim?

If you are not happy with the color of the colorcolumn , it can be changed easily by setting the color of the ColorColumn highlighting group. To see the list of colors that can be used for the guibg argument, type :help guibg in GVim. A detailed chart of Vim color names can be seen here.

What is Colorcolumn in Vim?

You can display a ruler at a specific line using the :set colorcolumn ( :set cc for short) option which is only available in Vim 7.3 or later. set colorcolumn=80. This will set the background color of that column to red, giving you a visual ruler to work from.


1 Answers

Use commas as delimiters to specify multiple columns, e.g.,

:set colorcolumn=40,80

-or-

:set cc=40,80

will set two colorcolumns, one at column 40 and one at column 80.

Also, += and -= can be used to add/remove columns:

:set cc+=60
:set cc-=80

will add column 60 and remove column 80, so the columns will now be 40 and 60.

like image 171
Rob Bednark Avatar answered Sep 21 '22 15:09

Rob Bednark