Skip to content

Instantly share code, notes, and snippets.

@infininight
Created December 13, 2011 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infininight/1473198 to your computer and use it in GitHub Desktop.
Save infininight/1473198 to your computer and use it in GitHub Desktop.
Release Notes

Release Notes

Notable changes since TextMate 1.5.10:

  • Multiple carets / discontinuous selection

    The easiest way to get multiple carets is by doing a left or right movement command (like arrow left/right) with a column selection. You can also ⌘-click to place new carets or use Edit → Find All (⌥⌘F).

  • Snippets

    New syntax for pop-up menus: ${1|first,second,…,last|}. In a Git commit message try fixup⇥ to get a pop-up of your last 10 commit messages (for a fixup!-commit) or between @interface@end in Objective-C you can try prop⇥ to get a @property-declaration with pop-up for its access type.

    Snippets can be nested, a frequent request but it does cause a few false firings of snippets which we haven’t yet found a good solution for.

  • Movement / Selection

    Text is classified into units which you can change with the characterClass (scope) setting. For example a C string with %1$ld\n has only two units (%1$ld and \n) for the purpose of selection (Select → Word or double click), word movement (⌥⇠/⌥⇢), and other functions that rely on character types.

    TextMate 1.x has Select → Block (⇧⌘B) where a block is found using scope-defined paired characters such as braces, brackets, etc. In 2.0 you can move to begin/end of such block with ⌃⇡/⌃⇣ and the paired characters can be strings (planned to be patterns).

    Whenever you select a unit (like anything in the Edit → Select submenu) the selection is “unanchored”, meaning it can be extended to either the left or right side. A minor thing but I find it surprisingly useful, e.g. to select foo(bar‸) we first select the parenthesis with ⇧⌘B and then extend left by one unit with ⌥⇧⇠, previously you couldn’t be sure the last step would extend or simply move the selection end point.

  • Themes

    There now is the ability to change font and font size per scope. So you’ll (by default) see that headings in markup are shown with a larger (non-fixed width) font.

    You can also change soft wrap on a per-line basis, so soft wrap is e.g. disabled (by default) for diffs embedded in Git commit messages, raw (code) blocks embedded in markup, and enabled for line comments in source.

    Soft wrap can be indented. This is also based on scoped settings so list items in markup are indented differently than line comments in source.

  • Foldings

    Foldings have been taken out of grammars and are now per-line (via scoped settings). In addition there are two new patterns to allow folding indented blocks.

  • Indent

    TextMate is more aggressive about doing indent corrections. This works great when the patterns are well-calibrated but can be disabled with the disableIndentCorrections scope-setting. This setting also change the behavior of re-indented paste to a heuristic that works much better with Python (for which indent corrections are disabled by default).

  • Folder specific settings

    Variables and some settings can be set on a folder / file-type basis.

  • Project drawer

    The project drawer has been replaced with a file browser sidebar. This file browser has most Finder functions (labels, duplicate, etc.) and does SCM-badging, presently only for Subversion, Git, and Mercurial. In addition it has support for running commands (although somewhat proof-of-concept ATM) and can also do custom data sources, the API is not yet public but an SCM Status data source is included (the smart folder icon) which show SCM status for the current project. This data source works great together with the various SCM bundles.

  • Buffer completion

    This has been improved to work with the existing word suffix (in addition to prefix), use the new character class system, etc.

  • Shell invocation

    Preferences → Terminal allows you to install mate which has a few new options and work when called as sudo mate. In addition you’ll find rmate which is a ruby implementation that you can use on a server over ssh.

  • Search in project / folder

    Revamped the old “Find in Folder” and merged it with the regular find dialog. It’s now asynchronous, a lot faster, and more flexible.

  • Format strings

    Format strings are ubiquitous in TextMate 2. Even scopes in grammars are format strings (allowing you to capture document content for use in scopes) and format strings are more powerful than the 1.x variant.

  • Scopes

    Scopes now contain info beyond document context. For example the attr.scm scopes give info about the current file’s SCM status, allowing using same key equivalent for different SCM systems.

    The dyn scopes give info such as “is there a selection” (allowing to change key bindings only when there is or isn’t a selection), an example of this is overloading { to “wrap selection” (nicely), but leave the key alone when there is no selection. Another use-case could be to change tab to shift the text right (indent) only when there is a selection (common user request that I don’t plan to make native behavior).

    You can also add your own stuff to the scope via the file and folder specific settings which allows e.g. adding attr.test to your unit tests and overload ⌘R for that scope or have certain snippets only fire in that scope (e.g. we have a main⇥ snippet for C which inserts the venerable main function — makes sense to overload this for (C) unit tests, which generally would be regular C files).

  • Scope selectors

    The caret is actually between two scopes, the left and right characters scope. In 2.0 we finally allow you to explicitly target either side (or both), making the firing of certain overloads more correct. There are also a few other new things related to scope selectors, but a lot of it is still only implemented in the parser, so will delay the thorough explanation of this.

  • Commands

    Commands can require other bundles which allow them to reference support files in the required bundle. They can also declare which shell commands they need which means better error handling and also having TextMate try to find the required commands. Failing commands result in more graceful error dialogs. The output options for a command has been split into location and format. Commands can run without a document.

  • Grammars

    Grammars can be injected into existing scopes, for example there are now grammars for marking URLs, TODO, and similar which are injected into comments and other appropriate places.

    Various other things related to parsing which require its own post.

  • Semantic classes

    Bundle items can now be assigned a semantic class. This allows us to query for e.g. action.build || action.run (for current scope) to find an appropriate build command (with a run command as fallback). The advantage of this is manyfold: ability to do tool bars, palettes, and unified key bindings, for example we have a single proxy item bound to ⌘Y which does a query for action.scm finding all the SCM actions relevant for the current scope (remember scope now include SCM info, making it pick the proper SCM system).

    Proxy items are a new construct but still at the proof-of-concept level, so more about this later.

    TextMate itself will also do queries at various times, for example when opening a file it queries for import commands, where we include several to decompile AppleScript, pretty-print binary property lists, and similar. It also uses this system on save, so by default we now make new scripts with a shebang executable after save.

    Like proxy items, this system is in its infancy.

  • Managed bundles

    When you open a file type for which you have no bundle, you’ll be asked to install one (if TextMate knows of one). Bundles are automatically kept up to date and you can see installed bundles (and install more) in Preferences → Bundles.

  • Session restore

    TextMate restores the full session which includes unsaved changes incase of abnormal exit. Hold shift (⇧) during launch to bypass.

  • Foreign Input Modes

    Display of CJK and “advanced” input modes is now be supported (although only limited testing has been done).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment