While I have tried to keep most of the functionality the same (to get functional changes spelled out in the commit history) there are some significant changes: When you open a folder or document(s) a default project folder will be based on the path(s) opened. This means that as long as you always open the root of your project (via `mate`, `open -a TextMate`, dragging the folder to TextMate, using the favorites (⇧⌘O), open dialog, `txmt:` URL scheme, or what have you), your project no longer require a `.tm_properties` file setting `projectDirectory` for Find in Folder (⇧⌘T), Go to File (⌘T), and similar to work as desired. Additionally the default properties now set a window title that include the project folder’s name (and SCM branch when available), so most projects can now also drop setting `windowTitle`. Furthermore the file browser (for when opening documents) will default to the project folder rather than the folder set in Preferences (the latter is still used if there is no document, e.g. after ⌘N or ⌃⌘N). The default project folder, even for opening a single document, means that opening more documents from the same folder (via Finder or perhaps something that uses the same temp folder for the local versions (which `rmate` does)) means that the following documents will open as tabs in the already open window (containing the first one opened). I _think_ this takes care of the common request of having all documents opened appear in new tabs of the frontmost window. For managing tabs the ‘Merge All Windows’ action now ignores minimized windows. This means that if you wish to only merge a few windows then you can minimize all but those you wish to merge and then perform the action. This commit should also address issue #117 (closing window’s last document via the file browser closes the entire window). Canceling a file open also no longer causes the entire window to close, but there’s still some work to do in this department (actually backtracking to previous state, which could mean closing the window if the window was opened only to show this document). Prior to this commit the tab bar would be automatically pruned when overflowing, this is no longer the case, though this functionality should return.
TextMate
This repository contains the source code for TextMate 2, a text editor for OS X 10.7+.
Building
Important
If you just want to run TextMate 2 then use this link to download a prebuilt binary. For 10.6 support you can try a 10.6 build (from the 10.6 fork) but it comes with no guarantee of actually working!
If you have problems building please don’t open an issue! Instead write the textmate-dev mailing list or use the #textmate IRC channel on freenode.net where people might be able to help you.
Bootstrap
To bootstrap the build you need to run ./configure (in the root of the source tree). You can set a few (environment) variables read by this script that change the generated build file:
builddir— location of built files. Defaults to~/build/TextMate.identity— for Apple’scodesign. Defaults to ad-hoc signing, which does not use an identity at all.boostdir— location of boost includes. By default it will search various locations including MacPorts and Homebrew.
In the simplest case you would run:
git clone https://github.com/textmate/textmate.git
cd textmate
git submodule update --init
./configure && ninja
Please note that if you downloaded the source code (rather than cloned via git) you likely miss the submodules and the build will therefore fail.
Prerequisites
To build the source the following must first be installed on your system:
- ninja — build system similar to
make - ragel — state machine compiler
- boost — portable C++ source libraries
- multimarkdown — marked-up plain text compiler
- mercurial — distributed SCM system
To install using MacPorts run:
sudo port install ninja ragel boost multimarkdown mercurial
If port fails with a build error then likely you need to agree (system-wide) to Apple’s Xcode license:
sudo xcodebuild -license
You can also install the above using homebrew:
brew install ragel boost multimarkdown hg ninja
In practice hg (mercurial) is only required for the SCM library’s tests so you can skip this dependency if you don’t mind a failing test.
OS X 10.7 (Lion)
If you are on OS X 10.7 you need pgrep and pkill (used by the “relaunch” build targets). To install using MacPorts:
sudo port install proctools
Or using homebrew:
brew install proctools
Clang 3.2 / 4.0
You also need a recent version of clang. This should be included with Xcode 4.4+ available for both Lion and Mountain Lion.
If you have multiple versions of Xcode installed, be sure to run sudo xcode-select -switch so that ./configure finds the most recent.
We also require the libc++ library, so while you can install clang from MacPorts or Homebrew, you’d need to also install this library (or make it use the one from Xcode).
Building from within TextMate
You should install the Ninja and CxxTest bundles. Both can be installed via Preferences → Bundles.
After this you can press ⌘B to build from within TextMate. In case you haven't already you also need to set up the PATH variable either in Preferences → Variables or ~/.tm_properties so it can find ninja and related tools; an example could be $PATH:/opt/local/bin.
The default target is TextMate/run. This will relaunch TextMate but when called from within TextMate, a dialog will appear before the current instance is killed. As there is full session restore, it is safe to relaunch even with unsaved changes.
If the current file is a test file then the target to build is changed to build the library to which the test belongs (this is done by setting TM_NINJA_TARGET in the .tm_properties file found in the root of the source tree).
Similarly, if the current file belongs to an application target (other than TextMate.app) then TM_NINJA_TARGET is set to build and run this application.
Build Targets
The build system classifies a target either as a library or an application. The latter can either be a bundled or non-bundled application. E.g. mate is non-bundled (just a mate executable) where TextMate.app is a bundled application.
For each output there are a few symbolic targets you can build. While the examples below refer to a specific library or application, they exist for all targets of same type.
For the io library:
ninja io # Build the io library and run tests.
ninja io/coerce # Build the io library and skip tests.
ninja io/clean # Remove the build folder for the io library.
ninja io/headers # Copy exported headers to $builddir/include.
For the mate (non-bundled) application:
ninja mate # Build the mate executable.
ninja mate/run # Build and run the mate executable.
ninja mate/clean # Remove the build folder for the mate executable.
For the TextMate.app application:
ninja TextMate # Build and sign TextMate.app.
ninja TextMate/run # Build, sign, and run TextMate.app.
ninja TextMate/clean # Remove the build folder for TextMate.app.
ninja TextMate/dsym # Create a tarball with extracted dSYM files.
ninja TextMate/tbz # Create a tarball of TextMate.app. Also produce the dsym tarball.
ninja TextMate/deploy # Push a nightly build. Fails without proper credentials :)
Note that ninja TextMate/clean only cleans the TextMate build folder ($builddir/Applications/TextMate) but all libraries and applications it depends on, are not cleaned.
To clean everything run:
ninja -t clean
Legal
The source for TextMate is released under the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
TextMate is a trademark of Allan Odgaard.
