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
Written by James Tomasino
Related protips
1 Response
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Viml
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#