I use something like this to warn me when I'm getting to a line length of 90-ish:
set textwidth=92 ░░░░
set colorcolumn=-0,-1,-2,-3 ░░░░
hi ColorColumn ctermbg=3 ctermfg=0 ░░░░
I'd like to also highlight the columns past the line length in another color, like:
set colorcolumn2=+1,+2,+3,+4,+5,+6,+7,+8,+9,+10 ░░░░▓▓▓▓▓▓▓▓▓▓
"or: execute "set cc=+" . join(range(1,255), ',+') ░░░░▓▓▓▓▓▓▓▓▓▓
hi ColorColumn2 ctermbg=1 ctermfg=15 ░░░░▓▓▓▓▓▓▓▓▓▓
I don't think there is such a thing as colorcolumn2
, but is there some way to accomplish this?
execute "set colorcolumn=+" . join(range(1,255), ',+')
hi OverLength ctermbg=1 ctermfg=15
match OverLength /\%>88v.\%<94v/ " lines (88,93)
It's subtler, and only highlights the first few columns on lines that are that long.matchadd()
, but it only highlights cells that have actual text so it's not really identical tocolorcolumn
. I'm not sure if there's a good set the background colour for parts of the screen that don't have text (related old question with a very ugly workaround: Is it possible to use two different color backgrounds in a single vim buffer?)