[TxMt] Re: Custom Folding

John Relosa john.relosa at yahoo.com
Wed Jul 13 17:19:25 UTC 2011


That works great thanks!
Is there a way to autocomplete the < symbol? I can do it with the { so when I 
press "{" TM autocompletes it with the end } so it automatically becomes {}. How 
can I add that functionality to the "<" symbol so it automatically becomes <>.
Thank you.
___________________________________________
You could easily customize the folding patterns.  It would be up to you to 
decide what your convention would be; just add those angle brackets in to the 
pattern and you should be on your way. 

 You can also easily add more folding patterns.  If I'm understanding your 
request right, you could simply match on "function" and "end function", etc, you 
just need to map them all out.  So, combined, something like this:  
foldingStartMarker = '\{<[^\/]+>\}|^(loop|function|if|on init)'; 
foldingStopMarker = '\{<\/.+>\}|^(end (loop|function|if|on))';  If you want to 
add more folding matches following the "X/end X" pattern, just add a pipe and 
the "X" to the parts in both expressions that look like this:  
(loop|function|if|on init)  Hope that helps, +dru  On Jul 13, 2011, at 8:23 AM, 
John Relosa wrote:  Hello,  thanks, this works ok but now every time I have any 
{comment}, TM shows a down fold arrow only (since there is no {/comment} 
obviously.  Is there a way to have the {block}...code...{/block} folding system 
differentiate from regular {comments}  It could be something like:  {<block>} 
{comment on code} code {comment on loop} {<loop>} loop code end {</loop} more 
code {</block>}  Only the {<...>} ...... {</...>} would have folding markers and 
not the regular {comment}.  Secondly regarding the language, there is no 
standard folding set but it would be nice to set up keywords that would start 
and end folds in user defined paired words like function.... end function, 
if...end if, on init...end on, etc... Is that possible?  Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20110713/a99d13e3/attachment.html>


More information about the textmate mailing list