Hi,
Sometimes the scroll bar at the bottom of the window indicates that there is a very long line somewhere, but a visual scan scrolling from top to bottom of the file doesn't show any line going beyond (or even near) the right edge of the window. This isn't a show stopper of course, but it would be nice to have a command of the form "select the longest line in the file and scroll to show it". Is there such a thing? If not, is there an easy way to add on a user tool to do the trick?
Thanks, Bill
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
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@lists.macromates.com http://lists.macromates.com/listinfo/textmate
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@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@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
thanks, I'll give it a try.
cheers, bill
On Jan 28, 2016, at 7:22 PM, Graham Heath wrote:
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@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@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
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.
Create a new Command; input: selection or text; output: discard
Command:
#!/bin/sh open txmt://open?line=`nl -nrz -w9 -b a|perl -pe 's/^\s+//g'| awk '{print length, $0}'|sort -nr|head -1|awk '{print $2}'`
--Hans
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 10:52 AM, Bill Paxton paxton@kitp.ucsb.edu wrote:
Hi,
Sometimes the scroll bar at the bottom of the window indicates that there is a very long line somewhere, but a visual scan scrolling from top to bottom of the file doesn't show any line going beyond (or even near) the right edge of the window. This isn't a show stopper of course, but it would be nice to have a command of the form "select the longest line in the file and scroll to show it". Is there such a thing? If not, is there an easy way to add on a user tool to do the trick?
Thanks, Bill
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 9! http://shop.oreilly.com/product/0636920044352.do iOS 9 Fundamentals! http://shop.oreilly.com/product/0636920044345.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
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