Skip to content

Repository files navigation

dune

CI License: PolyForm Shield 1.0.0 Platform: macOS + Linux + Windows TypeScript: strict pre-commit Dev env: Flox

A terminal code editor with a file tree, tabs, search, git marks, themes, vim mode, and tree-sitter highlighting for 30+ languages. dune is meant to feel like a small, fast project workspace rather than a shell command that happens to open one file.

When it starts, the first screen is the editor itself: a tree on the left, tabs across the top, a status bar along the bottom, and the active buffer taking the rest of the terminal. The tree supports preview tabs, pinned tabs, range selection, copy and move operations, guarded deletes, and mouse resizing. The editor keeps line numbers, indent guides, syntax colour, git change markers, a change track, and scrollbars in the terminal grid without requiring a GUI.

Status

dune is a Bun and TypeScript TUI built on OpenTUI. The app runs from source with Bun and ships as a self-contained executable for macOS, Linux, and Windows.

Quick Start

bun install
bun run start .

Build a local binary:

bun run build
./dist/*/dune .

Run the full local gate:

bun run check

Installation

Install from a release script:

curl -fsSL https://raw.githubusercontent.com/dotbrains/dune/main/install | bash

Or install the GitHub Packages shim after configuring npm for the GitHub registry:

npm config set @dotbrains:registry https://npm.pkg.github.com
npm install -g @dotbrains/dune
bun add -g @dotbrains/dune

The shim downloads the matching binary from the GitHub release. Set DUNE_DOWNLOAD_BASE to use a mirror.

Usage

dune                  # current directory
dune ./my-app         # directory
dune src/main.ts      # single file
dune src/main.ts:42   # open at line 42
dune update           # upgrade this installation

npx @dotbrains/dune and bunx @dotbrains/dune work once the package is published.

Shortcuts

Key Action
F1 / Ctrl+P / Ctrl+Opt+P Command palette
Ctrl+K Peek active shortcuts
Ctrl+O Open a file
Ctrl+T Switch tabs
Ctrl+S Save
Ctrl+F Find in file
Ctrl+R Search project
Ctrl+G Go to line
Ctrl+Opt+G Source control panel
Ctrl+Opt+M Markdown render/source
Ctrl+Opt+Z / Ctrl+Opt+Y Navigate back/forward
Ctrl+N New file
Ctrl+W Close tab
Ctrl+B Toggle sidebar
Ctrl+Q Quit
Ctrl+Z / Ctrl+Y Undo / redo
PgUp / PgDn, Ctrl+U / Ctrl+D Page editor

The file tree supports keyboard and mouse navigation, preview tabs, bulk moves and copies, guarded deletes, git status marks, and dimming for gitignored paths. Ctrl+C copies when text is selected and quits when it is not, so unsaved work is not thrown away. By default the tree lists dotfiles and gitignored files; use the View commands Show dotfiles and Hide gitignored files to change that per user config. Use Settings: this project to save overrides in .dune/settings.json; project values take precedence over ~/.config/dune/config.json when that workspace opens. Auto-save on blur and tab switch is on by default and can be disabled from Settings. External formatters can run on save by setting formatOnSave and a formatters map in user or project JSON, for example { "formatters": { "ts,tsx": ["prettier", "--write"] } }; formatter args may use {} as the file placeholder, otherwise the path is appended. By default dune follows the OS light/dark appearance using themeLight and themeDark; toggle themeSync off or pick a theme manually to pin one theme. Global shortcuts can be customized in JSON with keybindings, keyed by command id: { "keybindings": { "open": "Ctrl+Alt+O", "git.sourceControl": "F2" } }. The Transparent background setting leaves the editor and tab strip unpainted for translucent terminal themes. Set gitPanelView to list to show changed files as flat paths in the source control panel instead of the default folder tree.

PNG and JPEG files open as read-only image tabs. They are rendered in the editor slot, restore with the rest of the session, and are never treated as editable buffers.

Markdown files can be read as rendered documents with Ctrl+Opt+M or Markdown: rendered / source from the command palette. The same tab toggles between the rendered page and editable source, and unsaved edits are reflected in the rendered view.

The command palette includes Git actions for viewing diffs, committing selected files, undoing the last commit, stashing, popping a stash, fetching, and pushing. If files are already staged, the commit picker starts from the index selection; otherwise it selects all changed files. Diff overlays can be shown inline or split from Settings.

Ctrl+Opt+G swaps the sidebar to a compact source-control panel with changed files and status marks. Click a changed file there to open its diff.

Project Map

Path Purpose
src/app/ Application state, command dispatch, and root TUI composition
src/ui/ Reusable terminal UI components
src/editor/ Text buffer, edits, history, selection, windowing, and vim logic
src/core/ CLI parsing, filesystem, config, git, updates, sessions, and search
src/languages/ Tree-sitter grammar registry, queries, and highlighting
src/themes/ Theme builders, palette files, registry, and runtime theme state
bin/ Package launcher, install-time binary fetcher, and platform detection
scripts/ Release archive and Homebrew formula generation
test/ Bun unit and off-screen TUI tests

Development

Use Bun for all installs and scripts:

bun install
bun run check-types
bun run lint
bun run format:check
bun run test

Optional reproducible shell:

flox activate

Optional commit hooks:

pre-commit install
pre-commit run --all-files

More detail lives in:

License

This repository uses the PolyForm Shield License 1.0.0. See LICENSE.

About

A terminal code editor with a file tree, tabs, search, git marks, themes, vim mode, and tree-sitter highlighting for 30+ languages.

Resources

Stars

Watchers

Forks

Releases

Contributors

Languages