How do I find long lines in a large text file?
(I want to be able to define long lines arbitrarily.
For default, lets say, it is 80 characters.)

You can use the \%c (":help /\%c") token to ensure a columnar position. Thus, you could do something like

        :match Error /\%80c.*/

Or, alternatively, you could do something like

        :match Error /^.\{80,}/

The same methods work in other places (in :g// commands and :s// commands, as well as in regular searches), so if you wanted to comment out all the lines in your shell-script that have >80 characters (plus/minus one, due to my forgetfulness regarding the fence-posting of various operators), you could do

        :%s/^.\{81\}/#&

or you could indent all those lines:

        :g/\%80c/>

You can read about these tokens at

        :help /\%c
        :help /\{

HTH,

-tim



Reply via email to