Cool project... However, the terminal is where you enter passwords, ssh, set API keys etc. Something so sensitive should not be "Fully vibe coded".
For a project like this, I would expect to see a clarification which might read something like this: "Fully vibe coded, but I audited each and every line of generated code and I am already a domain expert in vt sequences and emacs so I know this program should be OK." But given that I did NOT see a clarification or statement like this, it becomes very difficult to trust a project like this.
Again, it is a cool idea.
On another note, as a light terminal user, I've had great success with MisTTY. [1]
Ghostty is a great piece of software, with a stellar maintainer who has a very pragmatic and measured take on using AI to develop software.
I used to have a Xerox Lisp Machine in the 1980s and dreamed to have Emacs be the ‘catch all’ environment like a Lisp Machine. Now I mostly just use Emacs to edit code.
Understanding the VT state machine and all its quirks and inconsistencies is not high up in my list of code I'd like to learn. It is good it is packaged up in a library and emacs is just a consumer of it.
libghostty will have excellent compatibility and features rather than an elisp implementation that maybe half baked.
I stopped living in the world of turtles all the way down. Now I'm more like, hey is this is good library ? Is it integrated well ? It does not matter if it is in zig, rust, c++, lisp, scheme, ...
But even locally I use vterm. A terminal is just text, why wouldn't I manipulate it with emacs? At any time you can switch to `copy-mode` and it behaves like a read-only text buffer that you can manipulate as you please.
Terminal emulator for Emacs built on libghostty-vt, the terminal emulation library from the Ghostty terminal emulator.
This project follows the same architecture as emacs-libvterm but uses Ghostty's terminal engine, which offers:
Status: Early prototype. Fully vibe coded. Only tested on macOS (Apple Silicon). Terminal works with ANSI colors, full key handling, scrollback, cursor sync, and drag-and-drop. Some character width mismatches with Powerline/NerdFont glyphs remain. Here be dragons.
--with-modules (dynamic module support)asdf install zig 0.15.2 or ziglang.org)(use-package gterm
:straight (:host github :repo "rwc9u/emacs-libgterm" :files ("*"))
:init
(setq gterm-always-compile-module t))
Note: The
:files ("*")is required so straight.el copies the Zig source files and build system, not just.elfiles.
(use-package gterm
:vc (:url "https://github.com/rwc9u/emacs-libgterm" :branch "main")
:init
(setq gterm-always-compile-module t))
Note:
use-package :vccopies all files by default, so no extra:filesconfiguration is needed.
(use-package gterm
:quelpa (gterm :fetcher github :repo "rwc9u/emacs-libgterm" :files ("*"))
:init
(setq gterm-always-compile-module t))
(use-package gterm
:load-path "/path/to/emacs-libgterm"
:init
(setq gterm-always-compile-module t))
(add-to-list 'load-path "/path/to/emacs-libgterm")
(require 'gterm)
Then M-x gterm to open a terminal.
vendor/ghostty (if not present)zig buildThe only prerequisite is having Zig and Git installed. Set gterm-always-compile-module to t to skip the confirmation prompt, or leave it nil to be asked first.
If you prefer to build manually:
git clone https://github.com/rwc9u/emacs-libgterm.git
cd emacs-libgterm
zig build
zig build test # run tests
Ghostty will be cloned automatically by zig build if not present, or you can clone it yourself:
git clone --depth 1 https://github.com/ghostty-org/ghostty.git vendor/ghostty
| Key | Action |
|---|---|
M-x gterm |
Open a new terminal |
| Arrow keys | Navigate / command history |
C-y / Cmd-V |
Paste from kill ring |
C-c C-k |
Enter copy mode (select text, y to copy, q to exit) |
Shift-PageUp/Down |
Scroll through history (page) |
| Mouse wheel / Trackpad | Scroll through history (5 lines) |
C-c C-v |
Snap back to live terminal |
C-c C-c |
Send Ctrl-C to shell |
C-c C-d |
Send Ctrl-D (EOF) to shell |
C-c C-z |
Send Ctrl-Z (suspend) to shell |
| Drag file from Finder | Send file path to terminal |
# Specify custom Emacs include path (for emacs-module.h)
zig build -Demacs-include=/path/to/emacs/include
# Build with optimizations
zig build -Doptimize=ReleaseFast
+----------------+ +---------------------+ +---------------+
| gterm.el |---->| gterm-module.so |---->| ghostty-vt |
| (Elisp) | | (Zig -> C ABI) | | (Zig lib) |
| | | | | |
| - PTY mgmt | | - Terminal create | | - VT parse |
| - Keybinds | | - Feed bytes | | - Screen |
| - Display | | - Styled render | | - Cursor |
| - Copy/Paste | | - Cursor track | | - Scrollback |
| - Scrollback | | - Mode query | | - Reflow |
+----------------+ +---------------------+ +---------------+
;; Change shell (default: /bin/zsh)
(setq gterm-shell "/bin/bash")
;; Change TERM variable (default: xterm-256color)
(setq gterm-term-environment-variable "xterm-256color")
;; Auto-compile without prompting
(setq gterm-always-compile-module t)
;; Mouse wheel scroll speed (default: 5 lines per event)
(setq gterm-mouse-scroll-lines 5)
GPL-3.0 (required for Emacs dynamic modules)