If you have Vim >= v7.3, you can simply add this to your .vimrc
to highlight 81 and onward (so 80 is your last valid column):
let &colorcolumn=join(range(81,999),",")
If you don't see a highlight, you may not have a ColorColumn
highlight color set. Add this (adjust to suit your preferences):
highlight ColorColumn ctermbg=235 guibg=#2c2d27
Now I like to highlight column 80 as well as 120 and onward, so I have separate "warning" and "danger" markers. You can do that thusly:
let &colorcolumn="80,".join(range(120,999),",")
Here's a screenshot of GVim editing my .vimrc
.
I use Ubuntu Mono 11 font and the molokai color scheme. You can find my vim config and all of my dotfiles on GitHub.
Highlight 81 column
:set textwidth=80
:set colorcolumn=+1
You may also make some styling:
:hi ColorColumn guibg=#2d2d2d ctermbg=246
Solution proposed in comment above. Highlight your background first then highlight the ColorColumn black as an overlay. Set your colorcolumn to lines 1-80.
hi Normal guibg=#32322f ctermbg=236
hi NonText guibg=#32322f ctermbg=236
hi ColorColumn guibg=#000000 ctermbg=0
let &colorcolumn=join(range(1,80),",")
try:
:/\%>80v./+
it will mark +80 characters as error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With