Skip to content

BenjaminX/textmate

 
 

Repository files navigation

TextMate

TextMate is a powerful, modular text editor for macOS with a sophisticated architecture built on efficient C++ data structures and an elegant Objective-C++ GUI layer.

Download

You can download TextMate from here.

Building

Dependencies

TextMate uses a custom build system based on rave configuration files and ninja. Install the following dependencies:

Install via Homebrew or MacPorts:

# Homebrew (recommended)
brew install boost capnp google-sparsehash multimarkdown ninja ragel

# MacPorts
sudo port install boost capnproto multimarkdown ninja ragel sparsehash

Initial Setup

git clone --recursive https://github.com/textmate/textmate.git
cd textmate
./configure && ninja TextMate/run

The ./configure script checks dependencies and generates build.ninja with default config set to release.

Common Build Commands

# Build TextMate
ninja TextMate

# Build and launch TextMate
ninja TextMate/run

# Clean build
ninja -t clean

# Run tests for a specific framework
ninja <framework_name>/test

# Build specific application
ninja <app_name>/run

Building from within TextMate

  1. Install the Ninja bundle via PreferencesBundles
  2. Set up PATH in PreferencesVariables or ~/.tm_properties (e.g., $PATH:/usr/local/bin)
  3. Press ⌘B to build

The default target is TextMate/run which will relaunch TextMate with full session restore.

Architecture Overview

TextMate follows a modular architecture with clear separation between low-level C++ data structures and high-level Objective-C++ GUI components.

Core Data Structures

  • oak::basic_tree_t - Balanced binary indexed tree (AA-tree) for text storage with O(log N) operations
  • ng::detail::storage_t - Efficient chunked memory storage in basic_tree_t
  • ng::buffer_t - Text buffer with semantic services (line/column tracking, syntax parsing, text marks)
  • ng::indexed_map_t - Segment tree providing map-like interface and indexed access for metadata
  • ng::layout_t - Text layout and rendering with line wrapping and folding support

Framework Organization

Core Frameworks:

  • buffer/ - Text storage and manipulation
  • editor/ - Text editing operations and transformations
  • parse/ - Grammar parsing and syntax highlighting
  • layout/ - Text layout and rendering
  • selection/ - Text selection handling
  • regexp/ - Regular expression and pattern matching

GUI Frameworks:

  • OakTextView/ - Main text editing view components
  • DocumentWindow/ - Document window management
  • FileBrowser/ - File browser sidebar
  • Find/ - Search and replace functionality
  • BundleEditor/ - Bundle editing interface

Support Frameworks:

  • io/ - File I/O, path manipulation, process execution
  • settings/ - Configuration and preferences
  • bundles/ - Bundle loading and management
  • scm/ - Source control integration (Git, SVN, Hg, P4)

Applications

  • TextMate/ - Main TextMate.app
  • mate/ - Command line tool
  • SyntaxMate/ - Syntax highlighting framework
  • Plus various utility applications

Testing

Tests use the CxxTest framework and are located in tests/ subdirectories:

  • t_*.cc or t_*.mm - Unit tests using CxxTest
  • gui_*.mm - GUI tests

Build test targets automatically based on current file location via .tm_properties.

Bundle Development

TextMate's functionality is extended through bundles containing:

  • Commands, snippets, and macros
  • Grammar definitions for syntax highlighting
  • Themes for visual appearance
  • Language-specific settings

Development Configuration

  • Uses .rave files for build configuration
  • Uses .tm_properties for TextMate-specific settings
  • C++2a standard with 3-space tabs
  • Precompiled headers in Shared/PCH/
  • Automatic framework include path configuration

Feedback

Please read the writing bug reports instructions before submitting issues.

Screenshot

textmate

本地编译状态

保留的配置文件:

  • local.rave - 工作的本地配置
  • default.rave - 默认构建配置
  • local-orig.rave - 原始配置备份
  • ✅ 项目原有的文档 (README.md, CLAUDE.md等)

编译环境:完全正常

  • ✅ 依赖项已正确安装
  • ✅ 配置文件已恢复正常
  • ✅ ARM64版本编译成功
  • ✅ TextMate.app可正常启动

使用方法:

# 开发构建 (debug)
./configure && ninja TextMate

# 发布构建 (release)
bin/rave -crelease -tTextMate && ninja TextMate

# 构建并启动
ninja TextMate/run

输出位置:

  • Debug: dist/debug/Applications/TextMate/TextMate.app
  • Release: dist/release/Applications/TextMate/TextMate.app

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.

About

TextMate is a graphical text editor for macOS 10.12 or later

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C++ 53.5%
  • C++ 40.7%
  • Ruby 2.5%
  • Objective-C 2.3%
  • C 0.4%
  • CSS 0.2%
  • Other 0.4%