Written by Anish Bhatt

Identify text crossing the 80 char limit in vim

First we assume a spherical cow with a vt100

If you use the Kernel coding style, one of the more taxing issues is staying within the 80 char limit. Instead of using something like checkpatch.pl to identify code failing this requirement after creating patches, you can use vim’s inbuilt long line highlight options to identify offending lines in code. The following snippet will highlight all any text that crosses virtual column 80

:match ErrorMsg '\%>80v.\+'

If you prefer something less in your face, the following snippet will only highlight characters at column 81

:2mat ErrorMsg '\%81v.'

You can also directly add these to your .vimrc file, removing the colon the at the start. More details can be found at the vim help page

comments powered by Disqus