vi-xva
Last Updated: February 25, 2016
·
1.534K
· jamestomasino
09c90fa1ab5a081d722e131db3efc3a0

Highlight text longer than 80 columns in vim

Add the following to your .vimrc to highlight any text that extends past the 80 column mark with a subtle red background.

" Highlight past 80 columns
if has('gui_running')
    highlight OverLength guibg=#592929
    match OverLength /\%>80v.\+/
endif

It's configured to only run in GUI versions of vim since it's pretty annoying in a term. It's very useful to bind the setting to a toggle key for quick checks.

Original Source: http://stackoverflow.com/a/235970/1041926

Say Thanks
Respond

1 Response
Add your response

800
Cd02928b9714479b681d1d24bb6360d7

If you're running Vim 7.3 (or better) you can use set colorcolumn=80 which draws the vertical bar at this column. It lets you easily see the desired text width.

To gracefully support older Vims, use:

if exists('&colorcolumn')
    set colorcolumn=80
endif

To change the color, use ColorColumn highlight group.

over 1 year ago ·