A tiny AppKit code editor in Swift, styled after Zed, with real tree-sitter syntax highlighting. ~3.9 MB app bundle, ~60 MB RAM.
- Zed-style layout and light themes — choose a palette in
settings.json. Paper Light is the default. Font and exact code/tree row heights are configurable. Zed-style header (tabs beside the traffic lights), the branch beside the project name, editor tabs with an active accent, compact file tree with Material Icon Theme file/folder icons + git-dirty markers, aligned gutter, current-line highlight. Fully flat — no Liquid Glass. - Tree ↔ tab sync — the active tab's file gets a persistent background row in the tree; the tree also shows git-dirty coloring.
- Status bar — open a project, find a recent project, open a new window, or
search from the left. The right shows the editor's
line:columnand toggles a shell below the editor, started in the current project directory. - File tabs — row height follows the window traffic lights and wraps when needed; active tabs use the same edge-to-edge background rule as the panel action buttons.
- Search panel — results grouped per file (name + folder) with line numbers and the match highlighted; click a file to open it, a line to jump to it.
- Git panel — flat Changes / Branch / History tabs, automatically staged changed files with status codes, branch, full-width commit message editor + commit. History starts with a coloured Git graph: curved ancestry tracks, solid commit dots, hollow merge dots, and an outer ring for HEAD. It uses the theme's accent colours, keeps the first-parent track's colour, and connects through expanded files and paginated commits. Wide graphs scroll horizontally; expanded files retain their hover-only button for opening the current source.
- Project history — under a project's changes, the commits of the branch checked out. The branch it was started from is named on a rule above that branch's commits, which are drawn a step back; a click on the rule folds them away. The branch's copy on its remote is labelled with the remote's name.
- Settings — the gear at the top right opens
~/.config/puzzle/settings.json. Editor font:buffer_font_family,buffer_font_size,buffer_font_weight,code_line_height,tab_size. Panel/UI font:ui_font_family,ui_font_size,ui_font_weight(ui_font_sizescales the whole tree/tab/panel type hierarchy), withtree_line_heightcontrolling file-tree rows. Saving re-applies live;//comments are allowed. - Editor details — active-line band and caret use the configured code-row
height, with code, line numbers and inline blame vertically centered; no gutter separator, and clickable line-number
code folding that preserves source line numbers. Matching
(),[]and{}are marked with red wave underlines at the insertion point. - File tree — lazy
NSOutlineView, folders-first, git-dirty markers, and whatever Git ignores drawn dimmed. - Dock menu — right-click the running app icon to open one of the ten most recently used valid project folders in a new Puzzle window.
- Editor —
NSTextView(TextKit 1), multi-file tabs, undo, and ⌘S. Buffers are written whenever they are left — another tab, another window, another app, or closing them — so nothing asks about unsaved changes. A file that changed on disk under an edit still asks, because only you can pick a side. - External changes — project files are monitored with FSEvents. A buffer with no unsaved edits follows the file; one with edits keeps them and reports the conflict, which is the one case saving stops to ask about.
- Syntax highlighting — vendored tree-sitter grammars for JSON, YAML,
Bash, TypeScript/JS, and Markdown, with
#eq?/#match?/#any-of?predicate evaluation and colours from the active theme. Adding a language is one entry inSyntaxHighlighter.languages+ a bundledhighlights.scm. - Find in file — native incremental find bar (⌘F).
- C completion —
.cand.hfiles useclangdfrom the app's PATH, with the active Xcode toolchain as a fallback. Use ↑↓ to choose a result, Tab or Return to insert it with a trailing space, and Esc to dismiss. The list stays open while editing the same prefix. Setshow_completiontofalseto turn it off. - Find in folder — project-wide search via ripgrep (built-in fallback).
- Git — branch beside the project name, dirty files marked in the tree, per-line gutter marks with revert, and a git panel (⌘3).
- Empty editor — with a project open and no file, a few shortcuts sit where the text goes, read from the menu so they always match it.
./build.shOn first run this fetches the tree-sitter runtime and grammars, the Material
Icon Theme, and SwiftTerm into vendor/ via vendor/fetch.sh. The build caches
the compiled libraries in .obj/, links them into the app, and bundles the
highlight queries plus the file-tree icons (Tools/generate-file-icons.py). Requires the Xcode
command-line tools; targets macOS 13+.
./build.sh release # optimised build
./Tools/install.sh # copy to /Applications + install the `pz` commandinstall.sh falls back to ~/Applications when /Applications is not
writable, and puts pz in the first writable directory on your login shell's
PATH. Installing is optional — the app also runs straight out of
build.noindex/. The suffix keeps Spotlight out of that folder, so a build is
not listed as a second Puzzle beside the installed one (Settings → General →
Storage → Applications).
open build.noindex/Puzzle.app # pick a folder on launch
open build.noindex/Puzzle.app --args /path/to/repo # open a project
open build.noindex/Puzzle.app --args /path/to/repo a.ts b.json # open files as tabsAd-hoc signed (not notarized). If Gatekeeper blocks it, right-click → Open, or
xattr -dr com.apple.quarantine build.noindex/Puzzle.app.
On first launch, Puzzle automatically installs or refreshes the bundled pz
command in the first writable directory on your login shell's PATH. It never
overwrites an unrelated command with the same name.
⌘N new window · ⌘O open folder · ⌘P quick open · ⌘S save · ⌘, settings · ⌘F find in file · ⌥⌘F find and replace · ⇧⌘F find in folder · ⌘L go to line · ⌘1 files · ⌘2 search · ⌘3 git · ⌘B show sidebar · ⇧⌘] next tab · ⇧⌘[ previous tab · ⌘W close tab · ⇧⌘W close window · ⇧⌘T reopen closed tab · ⌥⌘[ fold/unfold current block · ⌥⌘] unfold all · ⇧⌫ delete current line · ⌘/ toggle comment
In the Git lists (changes and history), ↑↓ move through the rows and ↩ does what a click does: opens a diff, or opens and closes a commit.
Sources/ Swift (Theme, workspace, tabs, tree, search, git, highlighter)
Sources/ts_bridge.h C bridging header for the tree-sitter API
Queries/ supplemental highlight queries (TS/JS ecma)
Tools/makeicon.swift masks Tools/appicon.jpg into AppIcon.icns
vendor/ tree-sitter runtime + grammars (fetched)
build.sh compiles C + Swift, builds the icon, bundles queries, signs
Opened by the gear button; created on first use at ~/.config/puzzle/settings.json
with every property documented inline. Keys and defaults:
| key | default | controls |
|---|---|---|
theme |
"paper-light" |
colour theme for the window and editor |
theme_overrides |
{} |
optional #RRGGBB colours for the selected theme, with examples in settings |
buffer_font_family |
"Monaco" |
code font in the editor |
buffer_font_size |
12 |
code font size (6–72) |
buffer_font_weight |
400 |
code weight; 600+ renders bold |
code_line_height |
27 |
exact code-row height in points (8–200) |
tab_size |
4 |
tab width in characters (1–16) |
ui_font_family |
"Monaco" |
font for tree / tabs / panels |
ui_font_size |
12 |
base UI size; scales the whole panel hierarchy (8–32) |
ui_font_weight |
400 |
UI weight; 600+ renders bold |
tree_line_height |
22 |
exact file-tree row height in points (8–200) |
NSTextViewis great for normal source files; multi-hundred-MB files are the wall that pushed Zed to a custom GPU renderer. Highlighting is skipped above ~500 KB to stay responsive.- Highlighting reparses incrementally: an edit is handed to
ts_tree_editand the previous tree is reused, so a keystroke costs the changed range rather than the whole document. The parse is still debounced.