[TxMt] Re: quick way to find longest line in file?

Graham Heath graham.p.heath at gmail.com
Fri Jan 29 03:22:48 UTC 2016


The best remove trailing white space remover I know of is in the Avian Missing TextMate Bundle:

https://github.com/elia/avian-missing.tmbundle

I do have it set to TM_STRIP_WHITESPACE_ON_SAVE = true

Graham Heath

> On Jan 28, 2016, at 5:27 PM, Bill Paxton <paxton at kitp.ucsb.edu> wrote:
> 
> Excellent suggestions -- thanks to both of you.
> 
> Turns out that I somehow got long sections of trailing blanks in several lines, and that's why a visual scan didn't show the location.
> 
> I'm sure there must be a way to delete trailing blanks from all lines -- could you tell me how or point me to the relevant information.
> 
> Thanks again,
> Bill
> 
> 
> 
> 
>> On Jan 28, 2016, at 4:33 PM, Matt Neuburg wrote:
>> 
>> Why not simply do a Find in the document for a regular expression of this sort:
>> 
>> ^.{100,}
>> 
>> ...that is to say, "a line longer than 100 characters"? For 100, substitute any number you think might be exceeded by just this one excessive line. m.
>> On Jan 28, 2016, at 4:14 PM, Hans-Jörg Bibiko wrote:
>> 
>> 
>> 
>> Hi Bill,
>> 
>> it's fast written ;) - and if you don't have more than 999999999 lines in your document:
>> 
>> 
>> 
>> Create a new Command; input: selection or text; output: discard
>> 
>> Command:
>> 
>> #!/bin/sh
>> open txmt://open?line=`nl -nrz -w9 -b a|awk '{print length, $0}'|sort -nr|head -1|awk '{print $2}'`
>> 
>> 
>> 
>> 
>> This command will locate the caret at the beginning of the longest line in the current document.
>> 
>> Cheers, Hans
>> 
>> 
>> 
>> _______________________________________________
>> textmate mailing list
>> textmate at lists.macromates.com
>> http://lists.macromates.com/listinfo/textmate
> 
> 
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20160128/91fd7d49/attachment.html>


More information about the textmate mailing list