How TextMate Customizes Settings for Different Languages and Projects
Updated
TextMate handles per-language and per-project customization through scoped settings: instead of one global configuration, you attach settings, key shortcuts, and commands to scope selectors that describe where they should apply. This lets a single file mixing languages, a project with its own build system, or third-party code with different formatting preferences each get the behavior it needs, without you switching profiles manually. The mechanism is documented on macromates.com as one of TextMate's core features, alongside bundles, commands, snippets, and macros.
How scoped settings work
A scope selector is a pattern that matches the "scope" of the text at the cursor — for example, the language of the current block, or a more specific context inside it. TextMate associates detailed scope selectors with settings and key shortcuts, so a setting only takes effect where the selector matches.
The practical consequence: you define a rule once, and TextMate applies it automatically as you move between regions of a file or between files. You are not toggling modes; the editor resolves which settings apply from the scope under the caret.
The mixed-language file case
macromates.com uses this exact example: "One file mixing languages?" A file that embeds, say, a different language inside a host language produces different scopes in different regions. Because settings are bound to selectors rather than to the whole file, each region can follow its own rules — indentation, formatting, or shortcuts — while remaining one document.
The project and third-party code case
The same mechanism covers two other situations the site names directly:
- Projects using different build systems — settings and shortcuts can be scoped so a project's build-related behavior applies where it belongs.
- Third-party code with different formatting preferences — formatting rules can be attached to the scope of that code instead of changing your defaults everywhere.
Bundles: the customization layer
TextMate uses bundles for customization and, per the site, supports "a countless number of different languages, markup systems, workflows, and more." Bundles are where language support and workflow-specific behavior live, which is why scoped settings scale: the scope vocabulary comes from the language/markup definitions, and the settings and shortcuts hang off those scopes.
Related customization tools worth knowing
Scoped settings are one part of a broader customization set described on the page:
| Feature | What it does |
|---|---|
| Commands | Custom actions written in any language that works with stdin, stdout, and environment variables; complex interactions can use WebKit or a dialog framework for Mac-native or HTML-based interfaces |
| Snippets | Reusable text/code with placeholders and transformations that adapt to context |
| Macros | Record a scratch macro for immediate replay, or save one for repeated use |
| Multiple carets | Make multiple changes at once, swap pieces of code, and similar bulk edits |
| File search | Search a selection for a pattern, then jump between matches, extract matched text, or preview replacements |
| Version control | See changed files in the file browser and changed lines in the editor, open a diff of the current file, and commit a subset — for all major version control systems |
What you need to run it
The download listed on the page is TextMate 2.0, and it requires macOS 10.12 or later. The editor is described as open source and as supporting a large list of programming languages. The page does not state pricing or licensing terms beyond "open source," so check the download page for current details before relying on any assumption about cost.
How to approach customization in practice
- Identify the scope, not the file. Decide where a behavior should apply — a language region, a project's build context, or a specific kind of third-party code — and treat that as the target.
- Attach the setting or shortcut to a selector for that scope, so it activates only there.
- Verify by moving the caret between regions of a mixed-language file or between files; the applied settings should change with the scope.
- Package language and workflow support as bundles when you want the customization to be reusable rather than one-off.
The common sticking point is expecting file-level or project-level switches; TextMate's model is selector-based, so the selector — not the open document — is what determines which settings win.