Last Updated: September 03, 2018
·
11.28K
· scott_woodall

vi: Display a vertical line at an arbitrary column width

set colorcolumn=80

Placing the above inside your .vimrc file will draw a vertical line inside vi. This is helpful if your coding style prefers to not have lines over a certain length.

Picture

3 Responses
Add your response

I'm pretty sure this doesn't work in vi. Vim >= 7.3 only.

over 1 year ago ·

By the way, here's the generic version of config (doesn't not error if option is not present):

if exists('&colorcolumn')
    set colorcolumn=80
endif
over 1 year ago ·

Extending on @dmedvinsky

if exists('+colorcolumn')
    set colorcolumn=80
else
    au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%80v.\+', -1)
endif

will emulate colorcolumn by simply coloring the overflowing characters.

over 1 year ago ·