uu7-aa
Last Updated: October 18, 2017
·
6.303K
· 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

Say Thanks
Respond

3 Responses
Add your response

2840
Cd02928b9714479b681d1d24bb6360d7

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

over 1 year ago ·
2873
Cd02928b9714479b681d1d24bb6360d7

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 ·
2882
B7aaf37de0dd4c9384d15a61995f6b27

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 ·