开发者

Is it possible to have (at the same time) colorcolumns in vim 7.3 with different colors, using the new colorcolumn option?

开发者 https://www.devze.com 2023-03-11 06:29 出处:网络
Vim 7.3 has a new option, colorcolumn. I can set a colo开发者_开发百科rcolumn color: :hi ColorColumn ctermbg=lightgrey guibg=lightgrey

Vim 7.3 has a new option, colorcolumn.

I can set a colo开发者_开发百科rcolumn color:

:hi ColorColumn ctermbg=lightgrey guibg=lightgrey

I can have how many colorcolumns I want, but I would like to know if it's possible to have two colorcolumns, each one of them with different colors. Anyone knows if this is possible, or a hack to achieve it using only this new colorcolumn feature?


Don't think that is possible, but you can sort-of fake it using the proposal in this post Vim 80 column layout concerns

highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.\+/

I.e. use colorcolumns but for the one farthest to the right, highlight everything exceeding that using the above.


I couldn't find a way. Fredrik's answer is a hack not using colorcolumn, but doesn't do exactly what I want.

I did a :h match and found the exactly line I need:

match OverLength /\%<73v.\%>72v/

...and, of course, the colorcolumn.

0

精彩评论

暂无评论...
验证码 换一张
取 消