[TxMt] Solution Approach for Hypersearch in TM (Find All in Document)

Hans-Joerg Bibiko bibiko at eva.mpg.de
Tue Oct 17 14:09:10 UTC 2006


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Hypersearch.tmCommand
Type: application/octet-stream
Size: 2080 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20061017/ff8a073b/attachment.tmCommand>


More information about the textmate mailing list