Search code examples
vimeditorjetbrains-idepep8

Double vertical line for editors


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

Most GUI editors such as those embedded in JetBrains IDEs have a similar facility called something like right margin line.

I use all of this for marking the 80th column.

Can I have an editor with the possibility of showing a further one lesser right margin line for comments at column 72?

Given enough time and effort I very much could have a similar facility in vim for marking text far beyond column 72 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?


Solution

  • Finally muru gave solution at vim.se.