@@ -10,11 +10,52 @@ process, keymap, and buffer.
1010
1111## Requirements
1212
13- - Emacs 25.1+ with dynamic module support
14- - [ Zig] ( https://ziglang.org/ ) 0.14+
13+ - Emacs 27.1+ with dynamic module support
1514- macOS or Linux
1615
17- ## Building
16+ The native module is ** automatically downloaded** on first use (pre-built
17+ binaries are available for macOS and Linux). If you prefer to build from
18+ source, you'll also need [ Zig] ( https://ziglang.org/ ) 0.14+ and the ghostty
19+ submodule (see [ Building from source] ( #building-from-source ) ).
20+
21+ ## Installation
22+
23+ ### use-package with vc (Emacs 30+)
24+
25+ ``` elisp
26+ (use-package ghostel
27+ :vc (:url "https://github.com/dakra/ghostel" :rev :newest))
28+ ```
29+
30+ ### use-package with load-path
31+
32+ ``` elisp
33+ (use-package ghostel
34+ :load-path "/path/to/ghostel")
35+ ```
36+
37+ ### Manual
38+
39+ ``` elisp
40+ (add-to-list 'load-path "/path/to/ghostel")
41+ (require 'ghostel)
42+ ```
43+
44+ Then ` M-x ghostel ` to open a terminal.
45+
46+ ### Native module
47+
48+ When the native module is missing, Ghostel will offer to ** download a
49+ pre-built binary** or ** compile from source** (controlled by
50+ ` ghostel-module-auto-install ` , default ` ask ` ). You can also trigger these
51+ manually:
52+
53+ - ` M-x ghostel-download-module ` — download a pre-built binary from GitHub releases
54+ - ` M-x ghostel-module-compile ` — build from source via ` build.sh `
55+
56+ ## Building from source
57+
58+ Building is only needed if you don't want to use the pre-built binaries.
1859
1960``` sh
2061# Clone with submodule
@@ -32,17 +73,6 @@ git submodule update --init vendor/ghostty
3273./build.sh
3374```
3475
35- ## Installation
36-
37- Add to your Emacs config:
38-
39- ``` elisp
40- (add-to-list 'load-path "/path/to/ghostel")
41- (require 'ghostel)
42- ```
43-
44- Then ` M-x ghostel ` to open a terminal.
45-
4676## Shell Integration
4777
4878Shell integration (directory tracking via OSC 7, prompt navigation via OSC 133,
@@ -109,7 +139,7 @@ Normal letter keys exit copy mode and send the key to the terminal.
109139| ` M-< ` / ` M-> ` | Jump to top / bottom of buffer |
110140| ` C-c C-n ` | Jump to next prompt |
111141| ` C-c C-p ` | Jump to previous prompt |
112- | ` C-t ` | Exit without copying |
142+ | ` C-c C-t ` | Exit without copying |
113143| ` a ` –` z ` | Exit and send key to terminal |
114144
115145Soft-wrapped newlines are automatically stripped from copied text.
@@ -118,33 +148,42 @@ Soft-wrapped newlines are automatically stripped from copied text.
118148
119149### Terminal Emulation
120150- Full VT terminal emulation via libghostty-vt
121- - 256-color and RGB color support
151+ - 256-color and RGB (24-bit true color) support
122152- Text attributes: bold, italic, faint, underline (single/double/curly/dotted/dashed with color), strikethrough, inverse
123153- Cursor styles: block, bar, underline, hollow block
124154- Alternate screen buffer (for TUI apps like htop, vim, etc.)
125155- Scrollback buffer (configurable, default 10,000 lines)
126156
127- ### Rendering
128- - Incremental redraw — only dirty rows are re-rendered
129- - Timer-based batched updates (~ 30fps) to avoid flicker
130- - Cursor position updates even without cell changes
157+ ### Links and File Detection
158+ - ** OSC 8 hyperlinks** — clickable URLs emitted by terminal programs (click or ` RET ` to open)
159+ - ** Plain-text URL detection** — automatically linkifies ` http:// ` and ` https:// ` URLs even without OSC 8 (toggle with ` ghostel-enable-url-detection ` )
160+ - ** File path detection** — patterns like ` /path/to/file.el:42 ` become clickable, opening the file at the given line (toggle with ` ghostel-enable-file-detection ` )
161+
162+ ### Clipboard
163+ - ** OSC 52 clipboard** — terminal programs can set the Emacs kill ring and system clipboard (opt-in via ` ghostel-enable-osc52 ` , useful for remote SSH sessions)
164+ - ** Bracketed paste** — yank from kill ring sends text as a bracketed paste so shells handle it correctly
131165
132166### Input
133- - Full keyboard input with GhosttyKeyEncoder (respects terminal modes)
134- - Mouse tracking with GhosttyMouseEncoder (press, release, drag)
167+ - Full keyboard input with Ghostty key encoder (respects terminal modes, Kitty keyboard protocol )
168+ - Mouse tracking (press, release, drag) via SGR mouse protocol — TUI apps receive full mouse input
135169- Focus events gated by DEC mode 1004
136- - Bracketed paste
137170- Drag-and-drop (file paths and text)
138171
139172### Shell Integration
140- - Directory tracking via OSC 7
141- - Prompt navigation via OSC 133 — jump between prompts with ` C-c C-n ` / ` C-c C-p `
142- - Title tracking (buffer renamed from OSC 2)
143- - OSC 8 hyperlinks — clickable URLs in terminal output (click or ` RET ` to open )
144- - Elisp eval from shell via OSC 51 — call whitelisted Emacs functions from shell scripts
145- - OSC 52 clipboard support (opt-in, for remote sessions)
173+ - Automatic injection for bash, zsh, and fish — no shell RC edits needed
174+ - ** OSC 7 ** — directory tracking ( ` default-directory ` follows the shell's cwd)
175+ - ** OSC 133 ** — semantic prompt markers, enabling prompt-to-prompt navigation with ` C-c C-n ` / ` C-c C-p `
176+ - ** OSC 2 ** — title tracking (buffer is renamed from the terminal title )
177+ - ** OSC 51** — call whitelisted Emacs functions from shell scripts (see [ Calling Elisp from the Shell ] ( #calling-elisp-from-the-shell ) )
178+ - ** OSC 52** — clipboard support (opt-in, for remote sessions)
146179- ` INSIDE_EMACS ` and ` EMACS_GHOSTEL_PATH ` environment variables
147180
181+ ### Rendering
182+ - Incremental redraw — only dirty rows are re-rendered
183+ - Timer-based batched updates with adaptive frame rate
184+ - Cursor position updates even without cell changes
185+ - Theme-aware color palette (syncs with Emacs theme via ` ghostel-sync-theme ` )
186+
148187### Calling Elisp from the Shell
149188
150189Shell scripts running inside ghostel can call whitelisted Elisp functions
@@ -203,34 +242,41 @@ individual faces with `M-x customize-face`.
203242
204243## Configuration
205244
206- | Variable | Default | Description |
207- | ------------------------------------| ---------------------| --------------------------------------------|
208- | ` ghostel-shell ` | ` $SHELL ` | Shell program to run |
209- | ` ghostel-shell-integration ` | ` t ` | Auto-inject shell integration |
210- | ` ghostel-buffer-name ` | ` "*ghostel*" ` | Default buffer name |
211- | ` ghostel-max-scrollback ` | ` 10000 ` | Maximum scrollback lines |
212- | ` ghostel-timer-delay ` | ` 0.033 ` | Redraw delay in seconds (~ 30fps) |
213- | ` ghostel-kill-buffer-on-exit ` | ` t ` | Kill buffer when shell exits |
214- | ` ghostel-eval-cmds ` | ` (see above) ` | Whitelisted functions for OSC 51 eval |
215- | ` ghostel-enable-osc52 ` | ` nil ` | Allow apps to set clipboard via OSC 52 |
216- | ` ghostel-prompt-reapply-on-redraw ` | ` nil ` | Re-apply prompt markers after full redraws |
217- | ` ghostel-keymap-exceptions ` | ` ("C-c" "C-x" ...) ` | Keys passed through to Emacs |
218- | ` ghostel-exit-functions ` | ` nil ` | Hook run when the shell process exits |
245+ | Variable | Default | Description |
246+ | ----------------------------------| ----------------------| ----------------------------------------------------------|
247+ | ` ghostel-module-auto-install ` | ` ask ` | What to do when native module is missing (` ask ` , ` download ` , ` compile ` , ` nil ` ) |
248+ | ` ghostel-shell ` | ` $SHELL ` | Shell program to run |
249+ | ` ghostel-shell-integration ` | ` t ` | Auto-inject shell integration |
250+ | ` ghostel-buffer-name ` | ` "*ghostel*" ` | Default buffer name |
251+ | ` ghostel-max-scrollback ` | ` 10000 ` | Maximum scrollback lines |
252+ | ` ghostel-timer-delay ` | ` 0.033 ` | Base redraw delay in seconds (~ 30fps) |
253+ | ` ghostel-adaptive-fps ` | ` t ` | Adaptive frame rate (shorter delay after idle, stop timer when idle) |
254+ | ` ghostel-full-redraw ` | ` nil ` | Always do full redraws instead of incremental updates |
255+ | ` ghostel-kill-buffer-on-exit ` | ` t ` | Kill buffer when shell exits |
256+ | ` ghostel-eval-cmds ` | ` (see above) ` | Whitelisted functions for OSC 51 eval |
257+ | ` ghostel-enable-osc52 ` | ` nil ` | Allow apps to set clipboard via OSC 52 |
258+ | ` ghostel-enable-url-detection ` | ` t ` | Linkify plain-text URLs in terminal output |
259+ | ` ghostel-enable-file-detection ` | ` t ` | Linkify file: line references in terminal output |
260+ | ` ghostel-keymap-exceptions ` | ` ("C-c" "C-x" ...) ` | Keys passed through to Emacs |
261+ | ` ghostel-exit-functions ` | ` nil ` | Hook run when the shell process exits |
219262
220263## Commands
221264
222- | Command | Description |
223- | --------------------------------| ---------------------------------------|
224- | ` M-x ghostel ` | Open a new terminal |
225- | ` M-x ghostel-other ` | Switch to next terminal or create one |
226- | ` M-x ghostel-clear ` | Clear screen and scrollback |
227- | ` M-x ghostel-clear-scrollback ` | Clear scrollback only |
228- | ` M-x ghostel-copy-mode ` | Enter copy mode |
229- | ` M-x ghostel-paste ` | Paste from kill ring |
230- | ` M-x ghostel-send-next-key ` | Send next key literally |
231- | ` M-x ghostel-next-prompt ` | Jump to next shell prompt |
232- | ` M-x ghostel-previous-prompt ` | Jump to previous shell prompt |
233- | ` M-x ghostel-force-redraw ` | Force a full terminal redraw |
265+ | Command | Description |
266+ | --------------------------------| ----------------------------------------------|
267+ | ` M-x ghostel ` | Open a new terminal |
268+ | ` M-x ghostel-other ` | Switch to next terminal or create one |
269+ | ` M-x ghostel-clear ` | Clear screen and scrollback |
270+ | ` M-x ghostel-clear-scrollback ` | Clear scrollback only |
271+ | ` M-x ghostel-copy-mode ` | Enter copy mode |
272+ | ` M-x ghostel-paste ` | Paste from kill ring |
273+ | ` M-x ghostel-send-next-key ` | Send next key literally |
274+ | ` M-x ghostel-next-prompt ` | Jump to next shell prompt |
275+ | ` M-x ghostel-previous-prompt ` | Jump to previous shell prompt |
276+ | ` M-x ghostel-force-redraw ` | Force a full terminal redraw |
277+ | ` M-x ghostel-sync-theme ` | Re-sync color palette after theme change |
278+ | ` M-x ghostel-download-module ` | Download pre-built native module |
279+ | ` M-x ghostel-module-compile ` | Compile native module from source |
234280
235281## Running Tests
236282
@@ -314,6 +360,7 @@ powering Neovim's built-in terminal.
314360| OSC 52 clipboard | Yes | Yes |
315361| Copy mode | Yes | Yes |
316362| Drag-and-drop | Yes | No |
363+ | Auto module download | Yes | No |
317364| Scrollback default | 10,000 | 1,000 |
318365| PTY throughput (plain ASCII) | 72 MB/s | 33 MB/s |
319366| Default redraw rate | ~ 30 fps | ~ 10 fps |
@@ -350,9 +397,10 @@ but with detection disabled ghostel reaches 74 MB/s. See the
350397[ Performance] ( #performance ) section above for full numbers and how to run the
351398benchmark suite yourself.
352399
353- ** Build.** Ghostel requires the [ Zig] ( https://ziglang.org/ ) toolchain and
354- links libghostty-vt (static) plus C++ dependencies. vterm uses CMake with a
355- single C dependency (libvterm) and can auto-compile on first load from Elisp.
400+ ** Installation.** Ghostel can automatically download a pre-built native
401+ module or compile from source with [ Zig] ( https://ziglang.org/ ) . vterm uses
402+ CMake with a single C dependency (libvterm) and can auto-compile on first
403+ load from Elisp.
356404
357405For a detailed architectural comparison, see [ design.org] ( design.org ) .
358406
@@ -362,7 +410,7 @@ For a detailed architectural comparison, see [design.org](design.org).
362410ghostel.el Elisp: keymap, process management, mode, commands
363411src/module.zig Entry point: emacs_module_init, function registration
364412src/terminal.zig Terminal struct wrapping ghostty handles
365- src/render.zig RenderState → Emacs buffer with styled text
413+ src/render.zig RenderState -> Emacs buffer with styled text
366414src/input.zig Key and mouse encoding via ghostty encoders
367415src/emacs.zig Zig wrapper for the Emacs module C API
368416src/ghostty.zig Re-exports and constants for the ghostty C API
0 commit comments