ghostel.el - 由 libghostty 驱动的终端模拟器

Lobsters Hottest 工具

摘要

ghostel.el 是一个 Emacs 包,提供由 libghostty 驱动的终端模拟器,具有 shell 集成、输入模式和内联图像支持等功能。

<p><a href="https://lobste.rs/s/xgdsao/ghostel_el_terminal_emulator_powered_by">评论</a></p>
查看原文
查看缓存全文

缓存时间: 2026/07/12 12:49

# 基于 libghostty 驱动的终端模拟器 来源:https://dakra.github.io/ghostel/ ## 目录 - 1\. 快速开始 (https://dakra.github.io/ghostel/#quick-start) - 1\.1\. Shell 集成概览 (https://dakra.github.io/ghostel/#orgf2af9da) - 1\.2\. 输入模式概览 (https://dakra.github.io/ghostel/#orgf6f1d30) - 2\. 系统要求 (https://dakra.github.io/ghostel/#requirements) - 3\. 安装 (https://dakra.github.io/ghostel/#installation) - 3\.1\. MELPA (https://dakra.github.io/ghostel/#orgd5b767d) - 3\.2\. use-package 配合 `:vc`(Emacs 30+)(https://dakra.github.io/ghostel/#org481bcbc) - 3\.3\. use-package 配合 `:load-path` (https://dakra.github.io/ghostel/#orgeb39c55) - 3\.4\. 手动安装 (https://dakra.github.io/ghostel/#org64f734e) - 3\.5\. 原生模块 (https://dakra.github.io/ghostel/#native-module) - 3\.6\. 平台说明 (https://dakra.github.io/ghostel/#platform-notes) - 3\.6\.1\. Windows (https://dakra.github.io/ghostel/#windows-platform-notes) - 4\. 从源码构建 (https://dakra.github.io/ghostel/#building-from-source) - 4\.1\. 绑定的 terminfo (https://dakra.github.io/ghostel/#orgbbf5ba6) - 5\. Shell 集成 (https://dakra.github.io/ghostel/#shell-integration) - 6\. 输入模式 (https://dakra.github.io/ghostel/#input-modes) - 6\.1\. 模式切换键绑定 (https://dakra.github.io/ghostel/#org90328ce) - 6\.2\. 半字符模式(默认)(https://dakra.github.io/ghostel/#semi-char-mode) - 6\.3\. 字符模式 (https://dakra.github.io/ghostel/#char-mode) - 6\.4\. Emacs 模式 (https://dakra.github.io/ghostel/#emacs-mode) - 6\.5\. 复制模式 (https://dakra.github.io/ghostel/#copy-mode) - 6\.6\. 鼠标选择 (https://dakra.github.io/ghostel/#mouse-selection) - 6\.7\. 行模式 (https://dakra.github.io/ghostel/#line-mode) - 6\.8\. 复制模式外的滚动搜索 (https://dakra.github.io/ghostel/#scrollback-search) - 7\. 功能特性 (https://dakra.github.io/ghostel/#features) - 7\.1\. 终端模拟 (https://dakra.github.io/ghostel/#terminal-emulation) - 7\.2\. 进程模型 (https://dakra.github.io/ghostel/#process-model) - 7\.3\. 书签 (https://dakra.github.io/ghostel/#bookmarks) - 7\.4\. 链接与文件检测 (https://dakra.github.io/ghostel/#links-and-file-detection) - 7\.5\. 剪贴板 (https://dakra.github.io/ghostel/#clipboard) - 7\.6\. 输入 (https://dakra.github.io/ghostel/#input) - 7\.7\. 密码提示检测 (https://dakra.github.io/ghostel/#password-prompt-detection) - 7\.8\. Shell 集成特性 (https://dakra.github.io/ghostel/#shell-integration-features) - 7\.9\. 渲染 (https://dakra.github.io/ghostel/#rendering) - 7\.10\. 内联图片(Kitty 图形协议)(https://dakra.github.io/ghostel/#inline-images) - 7\.10\.1\. 限制 (https://dakra.github.io/ghostel/#org089c392) - 7\.11\. 从 Shell 调用 Elisp (https://dakra.github.io/ghostel/#calling-elisp-from-the-shell) - 7\.12\. 通知与进度 (https://dakra.github.io/ghostel/#notifications-and-progress) - 7\.13\. 调色板 (https://dakra.github.io/ghostel/#color-palette) - 8\. TRAMP(远程终端)(https://dakra.github.io/ghostel/#tramp-remote-terminals) - 8\.1\. 远程 Shell 集成 (https://dakra.github.io/ghostel/#remote-shell-integration) - 8\.1\.1\. 选项1:自动注入(推荐,方便快捷)(https://dakra.github.io/ghostel/#org5da840e) - 8\.1\.2\. 选项2:手动设置(推荐用于永久远程主机)(https://dakra.github.io/ghostel/#org503a4d5) - 8\.2\. 远程 `xterm-ghostty` terminfo (https://dakra.github.io/ghostel/#remote-terminfo) - 8\.2\.1\. TRAMP 启动的 ghostel (https://dakra.github.io/ghostel/#org0e8d6f4) - 8\.2\.2\. 从本地 ghostel 缓冲区出站 `ssh` (https://dakra.github.io/ghostel/#org1a633fa) - 8\.2\.3\. 手动安装(无自动机制)(https://dakra.github.io/ghostel/#manual-terminfo-install) - 8\.2\.4\. 完全移除 Ghostty 广告 (https://dakra.github.io/ghostel/#org5b7d343) - 9\. 配置 (https://dakra.github.io/ghostel/#configuration) - 9\.1\. 进程与环境 (https://dakra.github.io/ghostel/#org433150d) - 9\.2\. 原生模块 (https://dakra.github.io/ghostel/#org45d0d61) - 9\.3\. TRAMP 与远程 (https://dakra.github.io/ghostel/#orga104a69) - 9\.4\. 渲染与性能 (https://dakra.github.io/ghostel/#org9bd95f0) - 9\.5\. 图像 (https://dakra.github.io/ghostel/#orgb88c8aa) - 9\.6\. 链接、剪贴板与检测 (https://dakra.github.io/ghostel/#orgaa87365) - 9\.7\. 密码提示 (https://dakra.github.io/ghostel/#org4eea8d3) - 9\.8\. 通知与进度 (https://dakra.github.io/ghostel/#org54fbf8d) - 9\.9\. 输入与交互 (https://dakra.github.io/ghostel/#orged142ca) - 9\.10\. 行模式 (https://dakra.github.io/ghostel/#orgb112fd8) - 10\. 扩展 (https://dakra.github.io/ghostel/#extensions) - 10\.1\. Evil 模式 (https://dakra.github.io/ghostel/#evil-mode) - 10\.2\. 编译模式 (https://dakra.github.io/ghostel/#compilation-mode) - 10\.2\.1\. 实时模式切换 (https://dakra.github.io/ghostel/#org3adce62) - 10\.2\.2\. 键绑定(`ghostel-compile-view-mode`,在只读运行期间同样有效)(https://dakra.github.io/ghostel/#org4a06225) - 10\.2\.3\. 让 `compile` / `recompile` / `project-compile` 使用 ghostel (https://dakra.github.io/ghostel/#org561f736) - 10\.2\.4\. 用于自定义集成的钩子 (https://dakra.github.io/ghostel/#org7e139e7) - 10\.3\. Eshell 集成 (https://dakra.github.io/ghostel/#eshell-integration) - 10\.4\. Comint 集成 (https://dakra.github.io/ghostel/#comint-integration) - 10\.5\. Emacs Lisp 输入法 (https://dakra.github.io/ghostel/#emacs-lisp-input-methods) - 11\. 命令 (https://dakra.github.io/ghostel/#commands) - 11\.1\. 从 Lisp 发送输入 (https://dakra.github.io/ghostel/#sending-input-from-lisp) - 11\.2\. 项目集成 (https://dakra.github.io/ghostel/#project-integration) - 12\. 运行测试 (https://dakra.github.io/ghostel/#running-tests) - 13\. 性能 (https://dakra.github.io/ghostel/#performance) - 13\.1\. 原生 vs Emacs PTY (https://dakra.github.io/ghostel/#native-vs-emacs-pty) - 13\.2\. 突发吸收(`cat` 一个 10 MB 文件)(https://dakra.github.io/ghostel/#burst-absorption) - 13\.3\. 输入延迟 (https://dakra.github.io/ghostel/#org5dc966e) - 14\. Ghostel 与 vterm 和 eat 的对比 (https://dakra.github.io/ghostel/#ghostel-vs-vterm) - 14\.1\. 功能比较 (https://dakra.github.io/ghostel/#org7d8f1cd) - 14\.2\. 主要差异 (https://dakra.github.io/ghostel/#orgf68f7ca) - 15\. 架构 (https://dakra.github.io/ghostel/#architecture) - 15\.1\. PTY 与进程所有权 (https://dakra.github.io/ghostel/#architecture-pty) - 15\.2\. 渲染器与缓冲区位置 (https://dakra.github.io/ghostel/#architecture-renderer) - 15\.2\.1\. 渲染器拥有的缓冲区位置保留 (https://dakra.github.io/ghostel/#orge59b296) - 15\.2\.2\. 避免在 Elisp 中进行 around-redraw 语义补丁 (https://dakra.github.io/ghostel/#org4dbf36e) - 16\. 贡献指南 (https://dakra.github.io/ghostel/#contributing) - 17\. 更新日志 (https://dakra.github.io/ghostel/#changelog) - 18\. 许可证 (https://dakra.github.io/ghostel/#license) - 19\. 索引 (https://dakra.github.io/ghostel/#indices) - 19\.1\. 命令与函数索引 (https://dakra.github.io/ghostel/#orga101743) - 19\.2\. 概念索引 (https://dakra.github.io/ghostel/#org857cc27) MELPA (https://melpa.org/#/ghostel) MELPA Stable (https://stable.melpa.org/#/ghostel) CI (https://github.com/dakra/ghostel/actions/workflows/ci.yml) Release (https://github.com/dakra/ghostel/releases) 许可证:GPL-3.0-or-later (https://github.com/dakra/ghostel/blob/main/LICENSE) VT 引擎:libghostty-vt (https://ghostty.org/) Ghostel 是一个由 libghostty-vt (https://ghostty.org/) 驱动的 Emacs 终端模拟器——该引擎与 Ghostty (https://ghostty.org/) 终端使用的 VT 引擎相同。用 Zig (https://ziglang.org/) 编写的原生动态模块处理终端状态、渲染以及本地 PTY I/O;Elisp 管理键映射、缓冲区、命令以及远程进程集成。Ghostel 受 emacs-libvterm (https://github.com/akermu/emacs-libvterm) 启发,并遵循相同的双层设计,但使用 Ghostty 的现代 VT 引擎替代 libvterm。这带来了 Kitty 键盘和图形协议、丰富的下划线样式、OSC 8 超链接、OSC 4/10/11 颜色查询以及同步输出(DEC 2026)——这些都是 libvterm 所不支持的。详细对比请参见 Ghostel 与 vterm 和 eat 的对比 (https://dakra.github.io/ghostel/#ghostel-vs-vterm)。 原生模块会在首次使用时自动下载,因此常见场景下无需工具链。使用 `M-x ghostel` 打开终端。 ## 目录 - 1\. 快速开始 (https://dakra.github.io/ghostel/#quick-start) - 1\.1\. Shell 集成概览 (https://dakra.github.io/ghostel/#orgf2af9da) - 1\.2\. 输入模式概览 (https://dakra.github.io/ghostel/#orgf6f1d30) - 2\. 系统要求 (https://dakra.github.io/ghostel/#requirements) - 3\. 安装 (https://dakra.github.io/ghostel/#installation) - 3\.1\. MELPA (https://dakra.github.io/ghostel/#orgd5b767d) - 3\.2\. use-package 配合 `:vc`(Emacs 30+)(https://dakra.github.io/ghostel/#org481bcbc) - 3\.3\. use-package 配合 `:load-path` (https://dakra.github.io/ghostel/#orgeb39c55) - 3\.4\. 手动安装 (https://dakra.github.io/ghostel/#org64f734e) - 3\.5\. 原生模块 (https://dakra.github.io/ghostel/#native-module) - 3\.6\. 平台说明 (https://dakra.github.io/ghostel/#platform-notes) - 3\.6\.1\. Windows (https://dakra.github.io/ghostel/#windows-platform-notes) - 4\. 从源码构建 (https://dakra.github.io/ghostel/#building-from-source) - 4\.1\. 绑定的 terminfo (https://dakra.github.io/ghostel/#orgbbf5ba6) - 5\. Shell 集成 (https://dakra.github.io/ghostel/#shell-integration) - 6\. 输入模式 (https://dakra.github.io/ghostel/#input-modes) - 6\.1\. 模式切换键绑定 (https://dakra.github.io/ghostel/#org90328ce) - 6\.2\. 半字符模式(默认)(https://dakra.github.io/ghostel/#semi-char-mode) - 6\.3\. 字符模式 (https://dakra.github.io/ghostel/#char-mode) - 6\.4\. Emacs 模式 (https://dakra.github.io/ghostel/#emacs-mode) - 6\.5\. 复制模式 (https://dakra.github.io/ghostel/#copy-mode) - 6\.6\. 鼠标选择 (https://dakra.github.io/ghostel/#mouse-selection) - 6\.7\. 行模式 (https://dakra.github.io/ghostel/#line-mode) - 6\.8\. 复制模式外的滚动搜索 (https://dakra.github.io/ghostel/#scrollback-search) - 7\. 功能特性 (https://dakra.github.io/ghostel/#features) - 7\.1\. 终端模拟 (https://dakra.github.io/ghostel/#terminal-emulation) - 7\.2\. 进程模型 (https://dakra.github.io/ghostel/#process-model) - 7\.3\. 书签 (https://dakra.github.io/ghostel/#bookmarks) - 7\.4\. 链接与文件检测 (https://dakra.github.io/ghostel/#links-and-file-detection) - 7\.5\. 剪贴板 (https://dakra.github.io/ghostel/#clipboard) - 7\.6\. 输入 (https://dakra.github.io/ghostel/#input) - 7\.7\. 密码提示检测 (https://dakra.github.io/ghostel/#password-prompt-detection) - 7\.8\. Shell 集成特性 (https://dakra.github.io/ghostel/#shell-integration-features) - 7\.9\. 渲染 (https://dakra.github.io/ghostel/#rendering) - 7\.10\. 内联图片(Kitty 图形协议)(https://dakra.github.io/ghostel/#inline-images) - 7\.10\.1\. 限制 (https://dakra.github.io/ghostel/#org089c392) - 7\.11\. 从 Shell 调用 Elisp (https://dakra.github.io/ghostel/#calling-elisp-from-the-shell) - 7\.12\. 通知与进度 (https://dakra.github.io/ghostel/#notifications-and-progress) - 7\.13\. 调色板 (https://dakra.github.io/ghostel/#color-palette) - 8\. TRAMP(远程终端)(https://dakra.github.io/ghostel/#tramp-remote-terminals) - 8\.1\. 远程 Shell 集成 (https://dakra.github.io/ghostel/#remote-shell-integration) - 8\.1\.1\. 选项1:自动注入(推荐,方便快捷)(https://dakra.github.io/ghostel/#org5da840e) - 8\.1\.2\. 选项2:手动设置(推荐用于永久远程主机)(https://dakra.github.io/ghostel/#org503a4d5) - 8\.2\. 远程 `xterm-ghostty` terminfo (https://dakra.github.io/ghostel/#remote-terminfo) - 8\.2\.1\. TRAMP 启动的 ghostel (https://dakra.github.io/ghostel/#org0e8d6f4) - 8\.2\.2\. 从本地 ghostel 缓冲区出站 `ssh` (https://dakra.github.io/ghostel/#org1a633fa) - 8\.2\.3\. 手动安装(无自动机制)(https://dakra.github.io/ghostel/#manual-terminfo-install) - 8\.2\.4\. 完全移除 Ghostty 广告 (https://dakra.github.io/ghostel/#org5b7d343) - 9\. 配置 (https://dakra.github.io/ghostel/#configuration) - 9\.1\. 进程与环境 (https://dakra.github.io/ghostel/#org433150d) - 9\.2\. 原生模块 (https://dakra.github.io/ghostel/#org45d0d61) - 9\.3\. TRAMP 与远程 (https://dakra.github.io/ghostel/#orga104a69) - 9\.4\. 渲染与性能 (https://dakra.github.io/ghostel/#org9bd95f0) - 9\.5\. 图像 (https://dakra.github.io/ghostel/#orgb88c8aa) - 9\.6\. 链接、剪贴板与检测 (https://dakra.github.io/ghostel/#orgaa87365) - 9\.7\. 密码提示 (https://dakra.github.io/ghostel/#org4eea8d3) - 9\.8\. 通知与进度 (https://dakra.github.io/ghostel/#org54fbf8d) - 9\.9\. 输入与交互 (https://dakra.github.io/ghostel/#orged142ca) - 9\.10\. 行模式 (https://dakra.github.io/ghostel/#orgb112fd8) - 10\. 扩展 (https://dakra.github.io/ghostel/#extensions) - 10\.1\. Evil 模式 (https://dakra.github.io/ghostel/#evil-mode) - 10\.2\. 编译模式 (https://dakra.github.io/ghostel/#compilation-mode) - 10\.2\.1\. 实时模式切换 (https://dakra.github.io/ghostel/#org3adce62) - 10\.2\.2\. 键绑定(`ghostel-compile-view-mode`,在只读运行期间同样有效)(https://dakra.github.io/ghostel/#org4a06225) - 10\.2\.3\. 让 `compile` / `recompile` / `project-compile` 使用 ghostel (https://dakra.github.io/ghostel/#org561f736) - 10\.2\.4\. 用于自定义集成的钩子 (https://dakra.github.io/ghostel/#org7e139e7) - 10\.3\. Eshell 集成 (https://dakra.github.io/ghostel/#eshell-integration) - 10\.4\. Comint 集成 (https://dakra.github.io/ghostel/#comint-integration) - 10\.5\. Emacs Lisp 输入法 (https://dakra.github.io/ghostel/#emacs-lisp-input-methods) - 11\. 命令 (https://dakra.github.io/ghostel/#commands) - 11\.1\. 从 Lisp 发送输入 (https://dakra.github.io/ghostel/#sending-input-from-lisp) - 11\.2\. 项目集成 (https://dakra.github.io/ghostel/#project-integration) - 12\. 运行测试 (https://dakra.github.io/ghostel/#running-tests) - 13\. 性能 (https://dakra.github.io/ghostel/#performance) - 13\.1\. 原生 vs Emacs PTY (https://dakra.github.io/ghostel/#native-vs-emacs-pty) - 13\.2\. 突发吸收(`cat` 一个 10 MB 文件)(https://dakra.github.io/ghostel/#burst-absorption) - 13\.3\. 输入延迟 (https://dakra.github.io/ghostel/#org5dc966e) - 14\. Ghostel 与 vterm 和 eat 的对比 (https://dakra.github.io/ghostel/#ghostel-vs-vterm) - 14\.1\. 功能比较 (https://dakra.github.io/ghostel/#org7d8f1cd) - 14\.2\. 主要差异 (https://dakra.github.io/ghostel/#orgf68f7ca) - 15\. 架构 (https://dakra.github.io/ghostel/#architecture) - 15\.1\. PTY 与进程所有权 (https://dakra.github.io/ghostel/#architecture-pty) - 15\.2\. 渲染器与缓冲区位置 (https://dakra.github.io/ghostel/#architecture-renderer) - 15\.2\.1\. 渲染器拥有的缓冲区位置保留 (https://dakra.github.io/ghostel/#orge59b296) - 15\.2\.2\. 避免在 Elisp 中进行 around-redraw 语义补丁 (https://dakra.github.io/ghostel/#org4dbf36e) - 16\. 贡献指南 (https://dakra.github.io/ghostel/#contributing) - 17\. 更新日志 (https://dakra.github.io/ghostel/#changelog) - 18\. 许可证 (https://dakra.github.io/ghostel/#license) - 19\. 索引 (https://dakra.github.io/ghostel/#indices) - 19\.1\. 命令与函数索引 (https://dakra.github.io/ghostel/#orga101743) - 19\.2\. 概念索引 (https://dakra.github.io/ghostel/#org857cc27)

相似文章

Libghostty 即将到来

Mitchell Hashimoto

Mitchell Hashimoto 宣布了 libghostty 的计划,这是一个可嵌入的终端模拟库,首先推出 libghostty-vt,这是一个从 Ghostty 中提取的零依赖终端序列解析器。

Ghostty 1.0 即将到来

Mitchell Hashimoto

Ghostty 1.0 是一款面向 macOS 和 Linux 的开源终端模拟器,将于 2024 年 12 月以 MIT 许可证公开发布,旨在成为现有终端的替代品,追求最快、功能最丰富且原生平台体验。

Ghostty: 反思1.0版本的发布

Mitchell Hashimoto

Mitchell Hashimoto 反思了他用 Zig 构建的终端模拟器 Ghostty 达到1.0版本的过程,讨论了项目的起源、成功但富有争议的内测版,以及他对这款终端的愿景。