[TxMt] REQUEST: Scope-based Find/Replace

Michael Sheets mummer at whitefalls.org
Tue Apr 1 09:13:40 UTC 2008


On Mar 31, 2008, at 8:32 PM, Alain O'Dea wrote:

> You mentioned by that a command isn't capable of accessing the  
> parsed version of any of the frontmost document. Does that mean that  
> the parsed version of the frontmost document is somehow accessible  
> to commands? That would be immensely useful to me for a variety of  
> purposes.

 From r948 in the release notes:

[NEW] One can now access the document as parsed by TextMate. To do so,  
create a new command (in the bundle editor), locate the command’s  
plist on disk, add the key inputFormat with a value of xml to this  
plist, and relaunch TextMate to have it use this modified command  
(it’s a new experimental feature, thus no UI for this). The input fed  
to the command will be wrapped in tags corresponding to the scope  
names. It also has the usual entity escapes. This form is probably not  
valid XML (because of the scope names which do not make for good tag  
names), but a simple regexp substitution should be able to convert it  
into something more useful, so I opted for using this “raw”  
representation, rather than turn it into XHTML with class arguments or  
similar. The Experimental bundle (at the Bundles svn repository) has a  
View Document as HTML command which converts the XML to XHTML with a  
minimal style sheet.


More information about the textmate mailing list