[TxMt] Re: replacing tabs with spaces in selected area & RE: How to change <form> tag coloring?

Brandon M Fryslie bmf at email.arizona.edu
Mon Jan 24 23:41:06 UTC 2011


RE: replacing tabs with spaces in selected area

You can use regular expressions in search and replace to do what you want,
but there is also a built in command.  Click 'Text' on the menu bar, then
under 'Convert' click Tabs to Spaces.  It will only convert the tabs in the
current selection.  Hold the option key while selecting to select a box
rather than the entire lines.

RE: How to change <form> tag coloring?

This is actually very easy (in theory), I'm surprised more people don't know
how TextMate works.  I'll tell you the steps to add a scope
called meta.tag.block.form.html to your html language bundle which can be
styled individually.  Note: this only adds a scope to the tag itself.  The
'block' part of the language file must be modified in a similar way to style
the block.

Open the bundle editor, go to the html bundle, then go to the HTML language
file.  Find the block within the patterns section that starts  { name =
'meta.tag.block.any.html';.  Select that entire block (from { to  }, ) and
duplicate it.  Of those two identical blocks, you will be editing the one
that appears closer to the top of the file.  Change meta.tag.block.any.html
to meta.tag.block.form.html.  Now change the line that starts 'begin' = ...
to begin = '(</?)((?i:form)\b)';

Done!  Open an html file and press shift+control+p in some different tags
and you should see the change in scope from any.html to form.html.  I added
a style to my theme for meta.tag.block.form.html and it only styles the form
tags.  You will have to play with it to get it exactly how you want, but I
hope this gives you enough info to get started.

<3 TextMate

Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20110124/6aab2c84/attachment.html>


More information about the textmate mailing list