Balance Jr 2.0 for TextMate ScreenCast!

The following is not exactly a transcript of the audio from my new Balance Jr 2.0 command screencast.

Balance Junior the 2nd Screencast

Balance Junior the 2nd Screencast

Download

tAylott_subtleGradient.tmbundle.zip

Or as always, you can grab all my stuff from my subversion repository. http://textmate.svn.subtlegradient.com/

Hello internet people

Thomas Aylott (aka subtleGradient) here to show you the latest edition of my Balance Jr command.

I noticed that there were a number of problems with the original that have always bugged me.

For example:

THIS ONE!!!! Where it selects the contents of string as well as the text between strings. Bleah, horrible.

Also, Duane Johnson released his snazzy Jump commands.

Here, have a goosee and the new regex. Note the lovely use of comments to disambiguate.

Let me show you a few things you can do with it.

Ok, there’s some HTML.

Balance Jr Foreword grabs stuff in big chunks When the caret is outside a tag it’ll grab the entire next tag. When the caret is INside a tag, it’ll grab the entire next attribute value pair, or whatever biggest thing it can get ahold of

Balance Jr Backwards is much more fine tuned As you can see.

for example, You can place the caret inside an html attribute’s value string, hit Balance Jr back and it selects the contents of the string, Hit it again and it’ll select outward until it grabs the entire tag.

ok! While we’re here…

Here’s my “add an HTML attribute” command. And Here’s Duane’s “Jump Next” command in action.

o…k

There are two built-in commands in the latest editions of TextMate EDIT/ SELECT/ “current scope” and EDIT/ SELECT/ “enclosing brackets”

note that both of these grab the brackets at the ends. While Balance Jr only grabs the innards!

Welp, that about wraps it up. goodnight everybody!

(?#

HTML tags that don't contain text
)<(\w+)[^>]*>[^<]*</\1>|(?#

The contents of various other forms of Embedded source
)(?<=(<%@\s|<%#\s|<%=\s))[^%]*(?=\s%>)|(?#

The contents of Embedded source
)(?<=<%\s)[^%]*(?=\s%>)|(?#

HTML Comments
)(?<=<!--\s)[^->]*(?=\s-->)|(?#

HTML Attribute name
)\b[\w-]+\b(?=\s*=)|(?#

HTML Attribute name value pair
)\s\b[\w-]+\b=\"[^\"]*\"|(?#

HTML Compatible "String Double"
)(?<=\")[^\"\n<>]*(?=\")|(?#

'String Single'
)(?<=')[^'\n]*(?=')|(?#

[Square Brackets]
)(?<=\[)[^\[\]]*(?=\])|(?#

{Curly Brackets}
)(?<={)[^{}]*(?=})|(?#

>Text Inside HTML Tag</
)(?<=[^/]>)[^><]*(?=</)|(?#

Hex Colors #AABBCC
)(?<=#)[0-9a-fA-F]{3,6}|(?#

Number
)(?<!\d)\d+(?:\.\d+)?(?!=\d)|(?#

@variables $variables !etc
)[@$!]\w+\b|(?#

/* Contents of Comment Blocks */
)(?<=/\*).*(?=\*/)|(?#

Comma Delimitated
)(?<=[\(,:])[^\(\),\n]*(?=[\),;])|(?#

CSS Attribute Values
)(?<=:)[^;}]*(?=;)|(?#

Closed xHTML Tags
)<[^>]*/>|(?#

Placer for adding HTML Attribute Values
)(?<=\")(?=(>|/>| />))|(?#

HTML Tags
)<[^>]*>|(?#

"String Double"
)(?<=\")[^\"\n]*(?=\")|(?#

Space and the end of the line
)\s+$|(?#

JS function names and variables
)\b[a-zA-Z][\w\.]*\b(?=(\[|\s*(&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|/=|%=|\+=|\-=|&=|\^=|\()))|(?#

The End :)subtleGradient