Dear all,
maybe you know the bundle 'Find All in Document'. This script lists all occurrences for a specific search pattern as an HTML page. You can click on a line and you jump to that line in the document.
I rewrote the script and I renamed it to 'Hypersearch'. (see attachment)
Changes/Improvements: - case insensitive search - result is shown as a table with line numbers (i.e. a better line distinction) - search result within a line is highlighted using bold and italics - there is no need to save your file in beforehand - it is 'relatively' easy to change the code - the code is 'rather' unicode save (i.e. It is not a problem to find a Japanese string. Only some regular expressions are not supported yet.) - tabs and spaces are shown like the source code (tabs are replaced by four spaces) - < and > are shown correctly - displays the number of lines which match against the search pattern
Problems: - I tried to implement to jump not only to the line but also to the right column but unfortunately it works only for ASCII. If there is e.g. a utf-8 'ö' or a Japanese character within the line the column number didn't fit. I used perl's pos() function but I get only the numbers of bytes. Hints are welcomed!! - Case insensitive search works but not for accented characters like ç, ä, é etc. You have to use e.g. the pattern 'ç|Ç' instead. - You cannot search for '§¢' and '¢§'. These strings are used internally.
The access key is ctrl+shift+f.
Implementation is done with CocoaDialog, grep, sed, and a bit perl within bash.
If someone find some bugs or have improvements etc., please don't hesitate to write me!
In other words, COMMENTS ARE WELCOMED!
Best,
Hans-Joerg Bibiko
On 17/10/06, Hans-Joerg Bibiko bibiko@eva.mpg.de wrote:
Dear all,
maybe you know the bundle 'Find All in Document'. This script lists all occurrences for a specific search pattern as an HTML page. You can click on a line and you jump to that line in the document.
I rewrote the script and I renamed it to 'Hypersearch'. (see attachment)
[snip]
If someone find some bugs or have improvements etc., please don't hesitate to write me!
In other words, COMMENTS ARE WELCOMED!
Just had a try of it and its a significant improvement. Well done and thanks!
Personally I'd love to see a 'Find as you type' like the find in page in Firefox, but this is the next best thing as I can search for a short string and pick out my result.
Thanks
Ed
On 10/17/06, Ed Singleton singletoned@gmail.com wrote:
Personally I'd love to see a 'Find as you type' like the find in page in Firefox, but this is the next best thing as I can search for a short string and pick out my result.
Does Ctrl-S do what you want?
/Nick
On 17/10/06, Nick Sieger nicksieger@gmail.com wrote:
On 10/17/06, Ed Singleton singletoned@gmail.com wrote:
Personally I'd love to see a 'Find as you type' like the find in page in Firefox, but this is the next best thing as I can search for a short string and pick out my result.
Does Ctrl-S do what you want?
You wouldn't believe the look on my face when I just tried that!
It works beautifully. Ctrl-S takes me forward through further matches, Ctrl-Shift-S takes me back.
I'd even say it works better than Firefox's.
Thanks very, very much
Ed
PS Where do I find all the other features that I don't know about? (except, I guess, for the upcoming book which I will buy as soon as possible now). I've previously looked through every menu and every useful looking bundle to try and familiarise myself and never saw this.
On 10/17/06, Ed Singleton singletoned@gmail.com wrote:
PS Where do I find all the other features that I don't know about? (except, I guess, for the upcoming book which I will buy as soon as possible now). I've previously looked through every menu and every useful looking bundle to try and familiarise myself and never saw this.
I use Select Bundle Item (⌃⌘T) quite a bit, but I wouldn't know how to find this one, I only stumbled onto it because of my emacs background, which uses the same keystroke.
/Nick
Dear all,
here comes an improved version.
Fixed: -result will also be highlighted for search pattern like '^foo'
Problems: -additionally to '§¢' and '¢§' you also cannot look for '¢¢' -regexp pattern \s is not supported; use instead \b
All the best,
Hans
********************************************************** Hans-Joerg Bibiko Max Planck Institute for Evolutionary Anthropology Department of Linguistics Deutscher Platz 6 phone: +49 (0) 341 3550 341 D-04103 Leipzig fax: +49 (0) 341 3550 333 Germany e-mail: bibiko@eva.mpg.de **********************************************************
I would just like to say, without taking up too much bandwidth ;-), that this is very cool.
Brett
On Oct 17, 2006, at 10:50 AM, Hans-Joerg Bibiko wrote:
Dear all,
here comes an improved version.
Fixed: -result will also be highlighted for search pattern like '^foo'
Problems: -additionally to '§¢' and '¢§' you also cannot look for '¢¢' -regexp pattern \s is not supported; use instead \b
All the best,
Hans
<Hypersearch.tmCommand>
Hans-Joerg Bibiko Max Planck Institute for Evolutionary Anthropology Department of Linguistics Deutscher Platz 6 phone: +49 (0) 341 3550 341 D-04103 Leipzig fax: +49 (0) 341 3550 333 Germany e-mail: bibiko@eva.mpg.de
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Hans-Joerg Bibiko wrote:
Dear all,
here comes an improved version [...]
A few suggestions:
1. Style the output using Soryu's beautiful css! 2. It would be cool if this could take line wrap into account. If allan added a `TM_SOFTWRAP` variable we could do it. - Incidentally, it seems like currently the lines wrap wherever they encounter a `-` character. This is not particularly useful. 3. Sometimes it would be nice to have a few lines of context. I'm not sure what the best way to input this into the command would be. 4. It would be nice to have some other options, like whether or not to use regular expressions, etc. I think ideally we could either make a Nib to allow the input of more complex things, or else we could have the dialog be a web form with a few fields. I think this would also be faster than bringing up Cocoa Dialog or an AppleScript dialog. 5. Commit this sucker to the repository, so we can split up the work on it.
Anyway, it seems pretty nifty. Thanks!
-Jacob
Dear all,
Jacob, thanks for the hints!
Here comes the next version of Hypersearch,
Changes: - output html style is set to Soryu's css - the found line numbers is displayed within the header - if I select a word or phrase within my document, this selection is taken as default for searching - I improved the line wrapping a bit (I don't substitute a single space with )
Jacob's suggestion to use a nib interface instead of CocoaDialog would be nice, but I don't know how to bind such an interface to TM or bash???? Jacob's suggestion to have a few lines of context is no problem by using grep. This would be an option for the nib interface.
Here is a first list of options for nib: - input: search string - option: use regular expression - input: how many lines of context should be displayed - option: wrap long lines - option: case sensitive search
Cheers,
Hans-Joerg
On 18. Oct 2006, at 11:52, Hans-Joerg Bibiko wrote:
Jacob's suggestion to use a nib interface instead of CocoaDialog would be nice, but I don't know how to bind such an interface to TM or bash????
We have introduced a new tm_dialog shell command which reads default parameters (for the nib) from stdin, and the name of the nib is an argument (-m/--modal to bring it up as a modal requester).
It then outputs the new values (as a plist) to stdout, including which button was pressed, and the return code of tm_dialog reflects the tag value of the pressed button.
It’s quite simple to use, but a little complicated to explain how to accomplish for non IB users, so I will do a screencast one of these days where I will go through creating a complex dialog.
Also, presently people need to checkout the code from the repository and compile it themselves. I will do a new build where this is included, when it has gotten a bit of testing.