Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/letstri/druk/llms.txt

Use this file to discover all available pages before exploring further.

Druk is a full-featured code editor that runs entirely inside your terminal. It ships as a single self-contained executable — no Node.js, no Bun, no runtime to install alongside it. Drop the binary on your PATH and druk opens any directory or file immediately. Druk supports macOS (arm64 and x64), Linux (arm64 and x64), and Windows (x64), with pre-built binaries available for every platform.
You can try Druk without installing anything. Run npx druk or bunx druk and the launcher fetches the binary on the fly, then opens the current directory.

Why Druk

Single binary distribution

The entire editor — syntax engine, git integration, LSP client, image viewer, and themes — is compiled into one executable. Nothing else to install, and no dependency on a system runtime.

30+ language syntax highlighting

Tree-sitter grammars provide accurate, incremental syntax highlighting for over thirty languages, from TypeScript and Rust to Go, Python, C, C++, Bash, and more.

Git integration

Changed lines are marked in the gutter and beside the scrollbar. The status bar shows the branch and ahead/behind counts. A built-in source-control panel lets you review diffs, stage files, commit, push, and switch branches — all without leaving the editor.

LSP support

Druk speaks the Language Server Protocol. It spawns whichever language servers are already on your PATHtypescript-language-server, gopls, rust-analyzer, and others — and surfaces diagnostics, hover, and autocompletion inline.

Architecture

Druk is a SolidJS application rendered to the terminal by OpenTUI. OpenTUI supplies the hard parts: layout, an editable text buffer with undo/redo and grapheme handling, mouse hit-testing, and the tree-sitter worker. The Druk codebase is the wiring around it. The source is organised into focused modules:
  • app/ — composition root, controllers (workspace, tree, git, lsp, settings, …), the command palette, and the global keymap.
  • core/ — platform utilities: CLI argument parsing, config resolution, filesystem operations, git queries and mutations, search, session persistence, and the upgrade logic.
  • editor/ — vim mode state machine, undo/redo coalescing, git-change and LSP-problem gutter columns, and auto-indent/auto-close logic.
  • lsp/ — JSON-RPC stdio transport, per-language server lifecycle, and the pure completion engine (normalize, fuzzy-filter, apply edits).
  • languages/ — tree-sitter grammar registry and highlight query files for every bundled language.
  • themes/ — 26 built-in colour schemes, each mapping UI chrome and tree-sitter capture groups to a palette.
  • ui/ — presentational components (EditorPane, FileTree, GitPanel, StatusBar, CommandPalette, SearchPanel, DiffView, ImageView, SettingsView, …) with no app-state imports.
The dependency direction is strictly one-way: ui/ and feature folders never import from app/. State lives in the app/ controllers, and components receive props and call callbacks.

Key capabilities

  • File tree with keyboard and mouse navigation, inline rename/delete/move/copy, and dotfile visibility control.
  • Tabbed editing with preview tabs (italic), pinned tabs, session restore per project, and background disk-sync.
  • Project and in-file search with fuzzy matching, regex, case-sensitive, and whole-word modes, plus find-and-replace.
  • Git gutter marks (M / A / U / D) on files and changed-line indicators in the editor margin and scrollbar track.
  • Markdown previewCtrl+Opt+M toggles rendered and source views on the same tab; edits appear in the preview without saving.
  • Image viewer for PNG and JPEG files, rendered with half-block cells directly into the terminal frame.
  • Vim mode — normal, insert, and visual modes with hjkl, word motions, counts, operators (d, y, c), and u/Ctrl+R undo/redo.
  • 26 built-in themes including Catppuccin, Dracula, Everforest, Gruvbox, Kanagawa, Nord, Rosé Pine, Tokyo Night, and more.
  • Two-layer settings — a user config at ~/.config/druk/config.json and a per-project override at <project>/.druk/settings.json. Every change applies immediately.

Build docs developers (and LLMs) love