[TxMt] Re: Suggestions for implementing incremental-search like functionality

Hans-Jörg Bibiko bibiko at eva.mpg.de
Thu Mar 13 20:37:37 UTC 2014


On Mar 13, 2014, at 1:47 PM, Chriztian Steinmeier wrote:

> I edit/write/manipulate a lot of XML files and I'd like to create a simple way to use XPath for searching/selecting in the current document. Ideally, I'd open a textfield akin to the "Incremental Search" (CTRL+S) field and just write the expression, hit enter and the results would open in a "Web Preview" window.
> 
> I can get the durrent document's contents and do the XPath stuff, but I don't know how to hi-jack (if at all possible) the Incremental Search bar, or create something that worked similar.
> 
> Any clues for how to approach that?

Hi Chriztian,

well, if you want to come up with the result in an HTML window then I'd go with BASH/Perl/Ruby/Python/... + HTML+JavaScript, i.e. create a tmcommand which creates an HTML page containing an INPUT field, the JS onChange event of that INPUT field triggers a JS function which take the XPATH, validates it and applies it to the document (use TextMate.system() JS-to-TM/BASH-bridge) and show the result, maybe via AXAJ injection, within the HTML window.

Cheers,
--Hans


More information about the textmate mailing list