ArticleslgStudy

computer science

TextMate

TextMate is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand TextMate rather than just read about it. In short: TextMate is a free and open-source general-purpose GUI text editor for macOS created by Allan Odgaard. TextMate features declarative customizations, tabs for open documents, recordable macros, folding sections, snippets, shell integration, and an extensible bundle system.

TextMate — main illustration
TextMate — illustration

Key takeaways

  • TextMate belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect TextMate to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of TextMate from memory before moving on to harder problems.

Reference excerpt

TextMate is a free and open-source general-purpose GUI text editor for macOS created by Allan Odgaard. TextMate features declarative customizations, tabs for open documents, recordable macros, folding sections, snippets, shell integration, and an extensible bundle system.

History TextMate 1.0 was released on 5 October 2004, after 5 months of development, followed by version 1.0.1 on 21 October 2004. The release focused on implementing a small feature set well, and did not have a preference window or a toolbar, didn't integrate FTP, and had no options for printing. At first only a small number of programming languages were supported, as only a few “language bundles” had been created. Even so, some developers found this early and incomplete version of TextMate a welcome change to a market that was considered stagnant by the decade-long dominance of BBEdit. TextMate 1.0.2 came out on 10 December 2004. In the series of TextMate 1.1 betas, TextMate gained several new features, including a preferences window with a GUI for creating and editing themes; a status bar with a symbol list; menus for choosing language and tab settings, and a “bundle editor” for editing language-specific customizations. On 6 January 2006, Odgaard released TextMate 1.5, the first “stable release” since 1.0.2. Reviews were positive, in contrast to earlier versions that had been criticised. TextMate continued to develop through mid-2006. On 8 August 2006, TextMate was awarded the Apple Design Award for Best Developer Tool, at Apple's Worldwide Developers Conference in San Francisco, California. In February 2006, the TextMate blog expressed intentions for future directions, including improved project management, with a plug-in system to support remote file systems such as FTP, and revision control systems such as Subversion. Throughout 2007, the core application changed only minimally, though its “language bundles” continued to advance. In June 2009, TextMate 2 was announced as being about 90 percent complete, but with an undisclosed final-feature list. A public alpha was made available for download on the TextMate blog in December 2011, followed by a release candidate at the end of 2016. In September 2019, a final version was released. In August 2012, TextMate 2's source code was published on GitHub under the terms of GPL-3.0-or-later, an attempt by the developer to counteract restrictions Apple placed on software distributed through the Mac App Store. Odgaard stated he prefers receiving patches as public domain as this preserves his ability to release a future version under a more permissive license, or to make a version available on the Mac App Store. Odgaard also stated he has a friend who uses some of TextMate's frameworks in a closed-source project, and they could not incorporate patches released under GPL. In October 2021, the latest/last commit was made to GitHub, though no announcement has been made to the effect that the project has been officially abandoned and its source code is still publicly available.

Features

Language grammars TextMate language grammars allows users to create their own arbitrarily complex syntax highlighting modes by assigning each document keyword a unique name. It uses a modified version of the Apple ASCII property list format to define language grammars. These grammars allow nesting rules to be defined using the Oniguruma regular expression library, and then assigned specific “scopes”: compound labels which identify them for coloration. Each point of a document is assigned one or more scopes, which define where in the document the point is, how it should be colored, and what the behavior of TextMate should be at that point. For instance, the title of one of the links in the “External links” section has the scope:

text.html.mediawiki markup.list.mediawiki meta.link.inline.external.mediawiki string.other.link.title.external.mediawiki

This scope tells us that we are looking at a link title within a link within a list within a MediaWiki document. TextMate themes can mark up any scope, at varying levels of precision. For instance, one theme may decide to color every constant (constant.*) identically, while another may decide that numerical constants (constant.numeric.*) should be colored differently than escaped characters (constant.character.escape.*). The hierarchal scope syntax allows language authors and theme authors various levels of coverage, so that each one can choose to opt for simplicity or comprehensiveness, as desired. TextMate documentation provides a list of naming commonly used across different programming languages for interoperability between bundles.

Commands TextMate supports user-defined and user-editable commands that are interpreted by bash or the interpreter specified with a shebang. Commands can be sent many kinds of input by TextMate (the current document, selected text, the current word, etc.) in addition to environment variables and their output can be similarly be handled by TextMate in a variety of ways. At its most simple, a command might receive the selected text, transform it, and re-insert it into the document replacing the selection. Other commands might simply show a tool tip, create a new document for their output, or display it as a web page using TextMate's built-in HTML renderer. Many language-specific bundles such as bash, PHP or Ruby contain commands for compiling and/or running the current document or project. In many cases the STDOUT and STDERR of the code's process will be displayed in a window in TextMate.

Snippets At their simplest, TextMate “snippets” are pieces of text which can be inserted into the document at the current location via a context-sensitive key stroke or tab completion. Snippets are "intelligent", supporting "tab stops" dynamic updating, access to environment variables, and the ability to run inline scripts. This allows complicated behaviors. Tab stops can be cycled through using the “tab” key and support default text, drop-downs, to complete elements of the snippet. The results of these tab stops can be dynamically changed in another portion of the snippet, as the user fills in a stop. TextMate environment variables can be used, supporting information about the current scope, line number, or author name, etc. Snippets also have the ability to run inline shell scripts.

… excerpt ends here. Continue reading the full article.

Illustrations

TextMate illustration
TextMate illustration
TextMate: TextMate Ruby syntax highlighting
TextMate Ruby syntax highlighting

Worked examples

Example 1 — a first encounter with TextMate

Start with the simplest possible case. Write down what TextMate claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to TextMate before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about TextMate ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of TextMate

In research
TextMate appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses TextMate in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
TextMate is common in secondary-school and first-year university syllabi. It links to neighbouring topics Formerly proprietary software, Free text editors, MacOS-only free software, so understanding it makes those chapters shorter.
In everyday life
Look for TextMate outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “TextMate” →

How to study TextMate in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what TextMate means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain TextMate out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is TextMate in simple terms?

TextMate is a free and open-source general-purpose GUI text editor for macOS created by Allan Odgaard. TextMate features declarative customizations, tabs for open documents, recordable macros, folding sections, snippets, shell integration, and an extensible bundle system.

Why does TextMate matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study TextMate?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on TextMate.

Tags

  • Formerly proprietary software
  • Free text editors
  • MacOS-only free software
  • MacOS text editors
  • Software using the GNU General Public License

Keep exploring