I once was given these materials to enable this helper for vim
to show kind of a vertical line in order to help enforce PEP8 rules on line length limit at column 80:
" Long lines highlighting.
nnoremap <Leader>H :call<SID>LongLineHLToggle()<cr>
hi OverLength ctermbg=none cterm=none
match OverLength /\%>80v/
fun! s:LongLineHLToggle()
if !&diff
if !exists('w:longlinehl')
let w:longlinehl = matchadd('ErrorMsg', '.\%>80v', 0)
echo "Long lines highlighted"
else
call matchdelete(w:longlinehl)
unl w:longlinehl
echo "Long lines unhighlighted"
endif
endif
endfunction
In action:
I use all of this for marking the 80th column.
Given enough time and effort I very much could have a similar facility in vim
for marking text far beyond column 72 only when in comment. I guess it has been already coded by somebody somewhere at some point. Do you already know where to find that snippet?
synID()
andsynIDattr()
. Something like:if ((synIDattr(synID(line("."), 72, 0), "name") =~ 'comment\c')
– Tumbler41 Jul 12 '17 at 23:08nnoremap
orautocmd
or something? Writing that to the:
console threwE110
andE15
🙁. – 13260 Jul 15 '17 at 0:50