Vertical editing

Vertical editing isn’t a new concept. Googling it with regards to TextMate, I see that it’s oft-referenced as one of the top features. But darnit, I didn’t just start using it until a couple weeks ago. So killer. In TextMate, trigger vertical editing by holding Option and then select using the mouse.

Looking back at CSS3 formatting, vertical editing pairs best with vertically aligned properties. It totally makes sense for editing big blocks of vendor-specific redundant properties. No more cringing when you have to tweak a transition style.

  .foo {
    -webkit-transition: opacity 1s;
       -moz-transition: opacity 1s;
         -o-transition: opacity 1s;
            transition: opacity 1s;
  }

Changing TextMate JavaScript reformat tab size

TextMate has an beautify command built into its default JavaScript bundle ⌃⇧H (Ctrl+Shift+H). To change the tab size used by the beautifier:

  1. Crack open the Bundle Editor. Bundles > Bundle Editor > Show Bundle Editor or ⌃⌥⌘B (Ctrl+Cmd+Opt++B)
  2. Select JavaScript > Reformat Document / Selection
  3. Add a second argument for the number of spaces to js_beautify($input)

For mine, with two space tabs, it looks like:

print js_beautify($input,2);

If you want to hack the PHP script that makes it all happen, you’ll find it in /Applications/TextMate.app/Contents/SharedSupport/Bundles/JavaScript.tmbundle/Support/lib/beautify.php

Thanks to help from Ryan Stout.

Textile missing block code syntax highlighting in TextMate

TextMate doesn’t have block code syntax highlighting for some reason. Here’s what I added to the Textile language in the Bundle editor, right after the blockquote portion:

{  name = 'markup.raw.textile';
  begin = '(^bc([<>=()]+)?)(\([^)]*\)|{[^}]*})*(\.)';
  end = '^$';
  captures = {
    1 = { name = 'entity.name.tag.raw.textile'; };
    3 = { name = 'entity.name.type.textile'; };
    4 = { name = 'entity.name.tag.raw.textile'; };
  };
  patterns = (
    {  include = '#inline'; },
    {  include = 'text.html.basic'; },
  );
},

⌃← and ⌃→

In TextMate, Ctrl + arrows jumps to next word(ish). It will stop at underscores and camel-cased letters.