A small, fast, native code editor for macOS, for people who write code by hand. Swift + AppKit, Core Text drawing, tree-sitter syntax, and its own minimal look: one background, hairlines, text instead of icons. The base for a live AI code tutor (coming later).
scripts/bundle.sh # builds build/Kite.app (release)
open build/Kite.app
swift test # buffer, editing, undo, multiple cursors, brackets, find, syntax, markdown
scripts/make-icon.sh # remakes the app icon (assets/AppIcon.icns) from assets/logo.svgWhile developing you can run the binary directly with files: .build/debug/Kite file.swift.
| Module | What it does | AppKit? |
|---|---|---|
EditorCore |
PieceTable (text storage, UTF-8), TextBuffer (line index, UTF-16 bridge, edit events), TextEditor (selection, every editing command, undo), TextFileCodec (encodings, line endings) |
No |
Syntax |
Tree-sitter parsing on a background queue, highlight queries with #eq?/#match?/#any-of? |
No |
Markdown |
A Markdown file as blocks with their source lines (parsed by Foundation), for the preview | No |
Kite |
The app: EditorView (Core Text, only visible lines), gutter, find bar, status bar, NSDocument, menus, BotsOverlay (the little bots) |
Yes |
Vendor/ |
tree-sitter v0.27.1 and its language grammars, compiled from source | – |
Every buffer change emits a BufferEdit (byte range + row/column). Syntax parsing listens to it,
and the AI tutor will too.
Languages with colors: Swift, Python, JavaScript/JSX, TypeScript, TSX, JSON, Markdown, Shell, HTML, CSS, YAML, Rust, Go, C, Java and diff/patch files. Anything else opens as plain text. Markdown files over 512 KB keep their block colors (headings, lists, code blocks) but not bold, code spans or links.
Adding a language: copy the grammar's src/ into Vendor/grammars/<name>, add its name to
grammarNames in Package.swift, add a case to Language, and copy its queries/highlights.scm to
Sources/Syntax/Queries/<name>.scm.
Kite --render file.swift out.png [--light] [--line N] [--select A:B] [--find text [--regex] [--find-in A:B]]
[--wrap] [--project DIR] [--quick-open QUERY] [--search QUERY] [--cursors A,B,…]
[--preview [--type TEXT]] # Markdown preview open; --type types at the top and waits for it
KITE_SNAPSHOT=out.png Kite folder file # saves the real window as drawn, then quits
# (KITE_PREVIEW=1 opens the Markdown preview first)
Kite --bench big-file.swift [--preview] # load, parse, typing and scrolling timings
Kite --selftest-save file.py # opens, edits, saves and checks the bytes on disk
scripts/budget.sh # builds release and checks size, launch, memory, typing, scrollEnvironment switches: KITE_NO_SESSION=1 neither restores nor saves the session;
KITE_SESSION_DIR=dir keeps it somewhere else; KITE_TEST_SCRIPT=… drives the running app for
end-to-end checks (edit-and-quit, report, start-return, note-recent, find,
project-replace; see DevTools.swift for what each expects).
One window per project: the file list on the left (text only; folders end in /, the open file is
brighter), Kite's own text tabs on top (a dot marks unsaved files, × appears on hover, middle-click
closes), the open file, and one status line at the bottom. Window buttons appear when the pointer
nears the top edge. Colors are flat: dimmed comments plus one hue each for keywords, strings and
numbers (View ▸ Rainbow Colors brings back the many-color theme). Bots are off unless turned on in
View ▸ Show Bots.
Quitting never asks to save. Next launch, every window comes back with its folder, size, tabs,
cursors and scroll positions, and unsaved edits come back still unsaved (their text is kept in
~/Library/Application Support/Kite/backups until you save or close the file). Closing a tab with
unsaved changes still asks. With nothing to restore, or when you click the Dock icon with no windows
open, Kite shows a plain list of recent folders and files: ↑↓ and Return, or click.
Open a folder with File ▸ Open Folder… (⇧⌘O), Kite path/to/folder, or by dropping it on the Dock
icon. The file list (⌘B) shows its files; .git, node_modules, .build, build, __pycache__ and
similar are hidden, and the tree updates when files change on disk. Any file you open from inside the
folder joins the project.
- ⌘P quick open: type a few letters of a file name (
edv→EditorView.swift). - ⇧⌘F search the whole project, with the same
case word regexswitches as the find bar. Results are grouped by file and appear as they're found; click one to open it with the match selected. Files open in Kite are searched as they are on screen. Binary files and files over 4 MB are skipped. - Replace in Files: type in the replace field and each match shows
- old/+ new. Click a match or a file to skip it, double-click to open it, then pressreplace N in M files. Every file is checked again first; one that changed since the search is left alone. Up to 20 files open as unsaved tabs (one undo step each; ⌥⌘S saves all). More than that, Kite asks once, saves them directly, and Edit ▸ Undo Replace in Files puts them back; files already open in Kite are changed in their tabs and left unsaved.
⌘F opens the find bar; ⌥⌘F adds the replace row. The switches are words: case, word, regex
and selection (⌥⌘C, ⌥⌘W, ⌥⌘R, ⌥⌘L). The count reads 3 of 12, or bad regex.
- Regex is ICU:
\w,\b, lookarounds,(?i);^and$match at each line, and a match can span lines. In the replacement,$1/${name}insert groups and\n/\ta newline and tab. With regex off, the replacement is used exactly as typed. selectionkeeps find and replace inside the selected block. It turns on by itself when you open find with several lines selected.- Return / ⇧Return: next / previous. In the replace field, Return replaces this match and moves on; ⌥Return replaces all (one undo step). ⌥Return in the find field (or ⌃⌘G) puts a cursor on every match (up to 1,000 cursors).
- Matches are counted in the background, so typing stays fast on big files even with a busy regex.
Code: ⌘T go to symbol (the file's functions and types, from the parse tree; no language server needed) · ⌃⇧⌘→ / ⌃⇧⌘← expand / shrink the selection by syntax (word, call, statement, block…) · the status line shows which function the caret is in.
Lines (Edit ▸ Lines, at every cursor): ⇧⌘D duplicate · ⇧⌘K delete · ⌃J join · sort · ⌃⇧U / ⌃⇧L upper / lower case · title case.
Editing: ⌘/ toggle comment · ⌘] / ⌘[ indent/outdent · ⌥↑ / ⌥↓ move line · ⌘C with nothing selected copies the line · ⌘L go to line.
Multiple cursors: ⌥-click adds a cursor (⌥-click it again to remove it) · ⌘D selects the word, then adds the next match · ⇧⌘L puts a cursor on each selected line · ⌥⌘↑ / ⌥⌘↓ add a cursor above/below · Esc back to one cursor. Typing, deleting, Return, Tab, cut, copy and paste work at every cursor; copying from N cursors and pasting into N cursors gives each its own line.
Tabs and windows: ⌘W close tab · ⇧⌘W close window · ⌃Tab / ⌃⇧Tab next/previous tab.
Find: ⌘F find · ⌥⌘F find and replace · ⌘G / ⇧⌘G next/previous · ⌃⌘G select all matches · ⌘E use selection · ⇧⌘F find in project · ⌘P quick open.
Files: ⌥⌘S save all.
View: ⌥Z word wrap (wrapped rows keep the line's indentation; off automatically for files over
200,000 lines) · ⌘B file list (⌃⌘S also works) · ⌘+ / ⌘- / ⌘0 text size · ⇧⌘B show/hide bots · ⇧⌘V Markdown
preview beside the editor (for .md files; updates as you type and follows your scrolling).
The editor outlines the bracket matching the one at the cursor (ignoring brackets inside strings and comments) and draws faint indent guides. Standard macOS text keys (⌥←, ⌘←, ⌃K, …) all work.
Kite is free software under the GNU General Public License v3.0. It bundles
tree-sitter and its language grammars, which are MIT licensed (see
Vendor/grammars/*/LICENSE).