The Mac-friendly command line text editor.
- Straightforward macOS editing experience from the command line.
- Familiar macOS text navigation shortcuts.
- Mouse support with single, double, and triple-click selection.
- Mouse wheel support for scrolling longer documents.
- System clipboard copy/paste/cut shortcuts
^C/^V/^X. - Undo/redo shortcuts with
^Z/^Y. - Save new or edited documents with
^S. - Search with
⌃Fand optional/regex/search. - Line numbers toggle with
⌃L. - Simple visual marker for documents that have unsaved changes.
- Proportional scrollbar you can drag to scroll through a document.
- Automatic line wrapping.
- Indentation preservation when moving to a new line.
- Automatic avoidance of opening binary files.
- Status footer with command hints, line/column counts, and selection summaries.
- Looks great in with or without terminal colors.
- Mac-like
^Qand^Wshortcuts to closetim. - Open documents over HTTP(S) like
tim https://mierau.me - Open text-friendly versions of Wikipedia articles like
tim --wikipedia albert einstein. - Open text formatted RSS/Atom feeds like
tim --rss www.apple.com/newsroom. - Open text formatted Bluesky feeds like
tim --bluesky @blippo.plus
- Ensure Xcode command line tools or a Swift 5.9+ toolchain is installed.
- Clone this repository.
- Build the CLI:
Add
swift build
-c releasefor a release optimized build.
Open tim without arguments to start with an empty buffer:
timOpen a file, optionally jumping to a specific line:
tim path/to/file
tim path/to/file:+42
tim +42 path/to/fileOpen a file over http(s):
tim https://web.site/document.htmlOpen a text-friendly Wikipedia article: Option: -w or --wikipedia
tim -w albert einsteinOpen an RSS or Atom feed: Option: -r or --rss
tim -r https://example.com/feed.xmlOpen a Bluesky user's public feed: Option -b or --bluesky
tim -b mierau.bsky.socialAdditional flags:
tim --helpprints the available options.tim --versionshows the current release tag.tim -reads buffer contents from standard input (ASCII or UTF-8 text only).tim -r <url>downloads and formats an RSS/Atom feed.tim -w <article title>fetches a text-friendly version of a Wikipedia article.tim -b <handle>fetches a Bluesky profile feed by handle, DID, or profile URL.- Use
--before a path that begins with-to treat it literally.
Find within the current buffer with ⌃F, advance matches with ⌃G, move backward with ⌃R, and press Esc (or ⌃F a second time) to close. After opening the prompt, pressing ⌃F moves focus to the document so subsequent typing edits the buffer; run ⌃F once more to exit. Surround the query with / characters to run a regular expression, e.g. /^[A-Z].*/.
This project is available under the terms of the MIT License.
src/app.swiftwires CLI parsing, document loading, and editor launchsrc/cli.swiftdefines the command-line interface (tim,-w,-r,-b, etc.)src/editorcontroller.swiftruns the terminal session and render loopsrc/editorstate.swiftstores buffer contents, selections, undo stacks, layout cache, and UI flagssrc/actions.swiftapplies text mutations, clipboard operations, and undo bookkeepingsrc/input.swiftreads raw key bytessrc/keys.swifttranslates key combos into editor actionssrc/mouse.swiftprocesses mouse wheel clicks/drags and scrollbar interactionsrc/layout.swiftconverts logical lines into wrapped visual rowssrc/renderer.swiftdraws the editor frame, gutter, footer, highlights, and cursorsrc/scrollbar.swiftcomputes proportional scrollbar geometry consumed by the renderersrc/terminal.swifthandles escape sequences, raw-mode setup, and alt-screen helperssrc/documentloader.swiftcoordinates local files, stdin, HTTP, Wikipedia, RSS, and Bluesky sourcessrc/http.swiftprovides synchronous networking utilities used by the loaderssrc/wikipedia.swiftformats article extracts for the editorsrc/rss.swiftparses feeds and renders plain-text timelinessrc/bluesky.swifttalks to the public Bluesky API and normalizes postssrc/clipboard.swiftbridges to macOSpbcopy/pbpastesrc/control.swifthouses small reusable UI helper structssrc/textfield.swiftimplements the editable field used by the find prompt and similar UI
Use tim to open text-friendly Wikipedia articles by title.
tim --wikipedia albert einstein
Use tim to open text formatted RSS/Atom feeds.
Use tim to open text formatted Bluesky feeds.