gpui-libghostty
Native Ghostty terminal and embedded Neovim components for GPUI.
Demo
Embedded Neovim editing this project's README with completion:
https://github.com/user-attachments/assets/140e3552-1074-4994-b91d-d0966fe623c9
Status
Project status is alpha, expect bugs and instability.
Crates
Published on crates.io: gpui-libghostty and gpui-neovim. Add either to your project:
gpui-libghosttyembeds a native Ghostty terminal in GPUI.gpui-neovimembeds Neovim in GPUI.
Supports macOS and Linux with Wayland.
Requirements
- Rust 1.95
- macOS and Xcode command-line tools, or Wayland with EGL, libc++ 21 or newer, libxml2, and desktop OpenGL 4.3
- Zig 0.16
- Neovim for
gpui-neovim
The default Nix development shell provides the Rust tools, Zig, Neovim, and
the required Linux build and runtime libraries. macOS still requires Xcode
command-line tools because the native build uses xcrun.
On Ubuntu 24.04, install libc++-21-dev and libc++abi-21-dev from
LLVM's APT repository, plus libxml2-dev from Ubuntu.
Set ZIG to select a non-default Zig executable. Set GPUI_NVIM or assign
NvimOptions::executable to select Neovim.
Terminal
[]
= "0.3"
use TerminalOptions;
bind_gpui!;
let terminal = spawn?;
Terminal::spawn returns an Entity<Terminal> you can render as a GPUI child.
To load the user's Ghostty configuration:
use TerminalConfiguration;
let mut options = new;
options.configuration = UserDefault;
Clipboard approval
Clipboard operations requiring approval are denied unless clipboard_approval
accepts them. Explicit Ghostty allow/deny settings still apply.
use Arc;
use ClipboardOperation;
// Example application policy: permit writes that Ghostty asks to confirm,
// but deny protected reads and unsafe pastes.
options.clipboard_approval = Some;
NvimOptions::clipboard_approval exposes the same policy for embedded Neovim.
Neovim
use NvimOptions;
bind_gpui!;
let editor = spawn?;
let editor = cx.new;
Call and await NvimEditor::open_file through the entity to reuse the running
Neovim instance.
Run the standalone example from this repository:
The optional argument is a file or directory. The example uses your Neovim
configuration; install nvim on PATH or set GPUI_NVIM to its executable.
Checks
GPUI compatibility
Neither library depends on GPUI. bind_gpui! uses your application's GPUI crate
or module path, including renamed packages such as gpui-pre.
Replace the old Terminal / NvimEditor imports with the bindings shown above.
Invoke the binding once at module scope, outside fn main(), and share the
generated types across your app. The Neovim binding also defines Terminal.
Checks cover the workspace's Zed revision and gpui-pre 0.3.4. GPUI API changes
may require an adapter update; arbitrary revisions are not guaranteed.
License
The workspace is MIT-licensed. Vendored Ghostty remains MIT-licensed; see
crates/gpui-ghostty/vendor/ghostty/LICENSE and
crates/gpui-ghostty/vendor/ghostty/VENDOR.md.