Skip to content

Instantly share code, notes, and snippets.

@0x8BADFOOD
Forked from fgarcia/long_lines.vim
Created April 2, 2016 04:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0x8BADFOOD/da8abd26c8a2b4b0333e9f8f58fa2751 to your computer and use it in GitHub Desktop.
Save 0x8BADFOOD/da8abd26c8a2b4b0333e9f8f58fa2751 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