Skip to content

Instantly share code, notes, and snippets.

@fgarcia
Created March 22, 2014 10:23
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save fgarcia/9704429 to your computer and use it in GitHub Desktop.
Save fgarcia/9704429 to your computer and use it in GitHub Desktop.
Highlight long lines (>80) and provide a toggle command
" Highlight long lines (>80)
autocmd BufEnter * highlight OverLength ctermbg=darkgrey guibg=#592929
autocmd BufEnter * match OverLength /\%81v.*/
autocmd BufEnter * let w:long_line_match = 1
fu! LongLineHighlightToggle()
highlight OverLength ctermbg=darkgrey guibg=#592929
if exists('w:long_line_match')
match OverLength //
unlet w:long_line_match
else
match OverLength /\%81v.*/
let w:long_line_match = 1
endif
endfunction
map <Leader>l :call LongLineHighlightToggle()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment