ghostty-config by sammcj/agentic-coding
npx skills add https://github.com/sammcj/agentic-coding --skill ghostty-configGhostty 终端模拟器的配置指南。Ghostty 使用基于文本的配置文件,具有合理的默认值,无需任何强制配置。
XDG 路径(所有平台):
$XDG_CONFIG_HOME/ghostty/config~/.config/ghostty/configmacOS 附加路径:
~/Library/Application Support/com.mitchellh.ghostty/config# 注释以 # 开头
background = 282c34
foreground = ffffff
font-family = "JetBrains Mono"
keybind = ctrl+z=close_surface
font-family = # 空值会重置为默认值
规则:
= 周围的空格是灵活的广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
ghostty --background=282c34文件按顺序处理——后面的条目会覆盖前面的。
# 包含额外的配置文件
config-file = themes/dark.conf
config-file = ?local.conf # ? 前缀表示可选(如果文件缺失不会报错)
重要提示: config-file 指令会在文件末尾处理。出现在 config-file 之后的键不会覆盖被包含文件中的值。
ctrl+shift+,cmd+shift+,某些选项无法在运行时重载。有些选项仅适用于新创建的终端。
Ghostty 通过 ghostty +<action> 提供 CLI 操作。使用 ghostty +<action> --help 获取特定操作的帮助。
| 命令 | 描述 |
|---|---|
ghostty +show-config | 显示当前生效的配置 |
ghostty +show-config --default | 显示默认配置 |
ghostty +show-config --default --docs | 显示带文档说明的默认配置 |
ghostty +validate-config | 验证配置文件是否存在错误 |
ghostty +edit-config | 在默认编辑器中打开配置文件 |
| 命令 | 描述 |
|---|---|
ghostty +list-fonts | 列出可用字体(等宽字体) |
ghostty +list-themes | 列出可用的颜色主题 |
ghostty +list-keybinds | 显示当前按键绑定 |
ghostty +list-keybinds --default | 显示默认按键绑定 |
ghostty +list-colors | 列出可用的颜色名称 |
ghostty +list-actions | 列出所有可用的按键绑定操作 |
| 命令 | 描述 |
|---|---|
ghostty +version | 显示版本信息 |
ghostty +help | 显示帮助 |
ghostty +show-face | 显示字体信息 |
ghostty +ssh-cache | 管理 SSH terminfo 缓存 |
ghostty +crash-report | 生成崩溃报告 |
ghostty +new-window | 打开新窗口(仅限 Linux) |
ghostty +boo | 彩蛋 |
每个配置键都可以作为 CLI 标志使用:
ghostty --background=282c34 --font-size=14
ghostty -e top # 在终端中运行命令
macOS 注意: ghostty CLI 是一个辅助工具。要启动终端,请使用 open -na Ghostty.app 或 open -na Ghostty.app --args --font-size=14。
格式:keybind = trigger=action
修饰键: shift, ctrl/control, alt/opt/option, super/cmd/command
keybind = ctrl+a=select_all
keybind = ctrl+shift+t=new_tab
keybind = super+backquote=toggle_quick_terminal
物理按键(W3C 代码): KeyA, key_a, Digit1, BracketLeft
按键序列(引导键):
keybind = ctrl+a>n=new_window # 按下 ctrl+a,释放,再按 n
keybind = ctrl+a>ctrl+n=new_window # 两者都带 ctrl
序列会无限期等待下一个按键。
| 前缀 | 效果 |
|---|---|
global: | 系统全局(macOS:需要辅助功能权限;Linux:需要 XDG Desktop Portal) |
all: | 应用于所有终端界面 |
unconsumed: | 不消耗输入(传递下去) |
performable: | 仅当操作成功时才消耗输入 |
组合前缀:global:unconsumed:ctrl+a=reload_config
注意: 序列不能与 global: 或 all: 前缀一起使用。
keybind = clear - 移除所有按键绑定keybind = ctrl+a=unbind - 移除特定绑定keybind = ctrl+a=ignore - 阻止 Ghostty 和终端处理该按键自动注入支持:bash , zsh , fish , elvish
shell-integration = detect # 默认 - 自动检测 shell
shell-integration = none # 禁用自动注入
shell-integration = fish # 强制使用特定 shell
shell-integration-features = cursor,sudo,title
shell-integration-features = no-cursor # 禁用特定功能
| 功能 | 描述 |
|---|---|
cursor | 在提示符处显示闪烁的光标条 |
sudo | 使用 sudo 时保留 terminfo |
title | 根据 shell 设置窗口标题 |
ssh-env | SSH 环境兼容性 |
ssh-terminfo | 在远程主机上自动设置 terminfo |
jump_to_prompt 按键绑定生效Bash(添加到 ~/.bashrc 顶部):
if [ -n "${GHOSTTY_RESOURCES_DIR}" ]; then
builtin source "${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash"
fi
Zsh:
source ${GHOSTTY_RESOURCES_DIR}/shell-integration/zsh/ghostty-integration
Fish:
source "$GHOSTTY_RESOURCES_DIR"/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish
macOS 注意: /bin/bash 不支持自动 shell 集成。请通过 Homebrew 安装 Bash 或手动加载脚本。
theme = light:catppuccin-latte,dark:catppuccin-mocha
quick-terminal-position = top
quick-terminal-size = 50%
quick-terminal-autohide = true
keybind = global:super+backquote=toggle_quick_terminal
palette = 0=#1d2021
palette = 1=#cc241d
# ... (支持 0-255)
font-family = "JetBrains Mono"
font-family-bold = "JetBrains Mono Bold"
font-size = 14
font-feature = -calt # 禁用连字
font-feature = -liga
background-opacity = 0.9
background-blur = true # 仅限 macOS, KDE Plasma
仅限 macOS:
window-position-x/y, window-save-state, window-step-resizewindow-vsync, window-colorspacemacos-titlebar-style, toggle_window_float_on_topfont-thicken, font-thicken-strengthtoggle_visibility, undo, redo, check_for_updates仅限 Linux/GTK:
window-title-font-family, window-subtitlewindow-titlebar-background/foreground(需要 window-theme = ghostty)window-show-tab-bar, gtk-single-instancetoggle_maximize, toggle_window_decorationstoggle_tab_overview, toggle_command_paletteprompt_surface_title仅限 Linux Wayland:
quick-terminal-keyboard-interactivitygtk-quick-terminal-layer, gtk-quick-terminal-namespace仅限 FreeType (Linux):
freetype-load-flags要获取完整的选项和按键绑定参考,请加载:
references/options.md - 按类别(字体、颜色、窗口等)列出的所有配置选项references/keybindings.md - 所有带参数的按键绑定操作当您需要特定选项的详细信息、有效值或按键绑定操作语法时,请加载这些文件。
每周安装数
81
代码仓库
GitHub 星标数
113
首次出现
2026年1月30日
安全审计
安装于
opencode78
codex78
gemini-cli76
cursor74
github-copilot73
kimi-cli71
Guidance for configuring the Ghostty terminal emulator. Ghostty uses text-based config files with sensible defaults and zero required configuration.
XDG Path (All Platforms):
$XDG_CONFIG_HOME/ghostty/config~/.config/ghostty/config if XDG_CONFIG_HOME undefinedmacOS Additional Path:
~/Library/Application Support/com.mitchellh.ghostty/config# Comments start with #
background = 282c34
foreground = ffffff
font-family = "JetBrains Mono"
keybind = ctrl+z=close_surface
font-family = # Empty value resets to default
Rules:
= is flexibleghostty --background=282c34Files processed sequentially - later entries override earlier ones.
# Include additional configs
config-file = themes/dark.conf
config-file = ?local.conf # ? prefix = optional (no error if missing)
Critical: config-file directives are processed at the file's end. Keys appearing after config-file won't override the included file's values.
ctrl+shift+,cmd+shift+,Some options cannot be reloaded at runtime. Some apply only to newly created terminals.
Ghostty provides CLI actions via ghostty +<action>. Use ghostty +<action> --help for action-specific help.
| Command | Description |
|---|---|
ghostty +show-config | Show current effective configuration |
ghostty +show-config --default | Show default configuration |
ghostty +show-config --default --docs | Show defaults with documentation |
ghostty +validate-config | Validate configuration file for errors |
ghostty +edit-config | Open config file in default editor |
| Command | Description |
|---|---|
ghostty +list-fonts | List available fonts (fixed-width) |
ghostty +list-themes | List available colour themes |
ghostty +list-keybinds | Show current keybindings |
ghostty +list-keybinds --default | Show default keybindings |
ghostty +list-colors | List available colour names |
ghostty +list-actions |
| Command | Description |
|---|---|
ghostty +version | Show version information |
ghostty +help | Show help |
ghostty +show-face | Show font face information |
ghostty +ssh-cache | Manage SSH terminfo cache |
ghostty +crash-report | Generate crash report |
ghostty +new-window | Open new window (Linux only) |
Every config key works as a CLI flag:
ghostty --background=282c34 --font-size=14
ghostty -e top # Run command in terminal
macOS Note: The ghostty CLI is a helper tool. To launch the terminal use open -na Ghostty.app or open -na Ghostty.app --args --font-size=14.
Format: keybind = trigger=action
Modifiers: shift, ctrl/control, alt/opt/option, super/cmd/command
keybind = ctrl+a=select_all
keybind = ctrl+shift+t=new_tab
keybind = super+backquote=toggle_quick_terminal
Physical keys (W3C codes): KeyA, key_a, Digit1, BracketLeft
Key sequences (leader keys):
keybind = ctrl+a>n=new_window # Press ctrl+a, release, press n
keybind = ctrl+a>ctrl+n=new_window # Both with ctrl
Sequences wait indefinitely for next key.
| Prefix | Effect |
|---|---|
global: | System-wide (macOS: needs Accessibility permissions; Linux: needs XDG Desktop Portal) |
all: | Apply to all terminal surfaces |
unconsumed: | Don't consume input (passes through) |
performable: | Only consume if action succeeds |
Combine prefixes: global:unconsumed:ctrl+a=reload_config
Note: Sequences cannot be used with global: or all: prefixes.
keybind = clear - Remove ALL keybindingskeybind = ctrl+a=unbind - Remove specific bindingkeybind = ctrl+a=ignore - Prevent processing by Ghostty and terminalAuto-injection for: bash , zsh , fish , elvish
shell-integration = detect # Default - auto-detect shell
shell-integration = none # Disable auto-injection
shell-integration = fish # Force specific shell
shell-integration-features = cursor,sudo,title
shell-integration-features = no-cursor # Disable specific feature
| Feature | Description |
|---|---|
cursor | Blinking bar at prompt |
sudo | Preserve terminfo with sudo |
title | Set window title from shell |
ssh-env | SSH environment compatibility |
ssh-terminfo | Auto terminfo on remote hosts |
jump_to_prompt keybinding worksBash (add to ~/.bashrc at top):
if [ -n "${GHOSTTY_RESOURCES_DIR}" ]; then
builtin source "${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash"
fi
Zsh:
source ${GHOSTTY_RESOURCES_DIR}/shell-integration/zsh/ghostty-integration
Fish:
source "$GHOSTTY_RESOURCES_DIR"/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish
macOS Note: /bin/bash does NOT support automatic shell integration. Install Bash via Homebrew or manually source the script.
theme = light:catppuccin-latte,dark:catppuccin-mocha
quick-terminal-position = top
quick-terminal-size = 50%
quick-terminal-autohide = true
keybind = global:super+backquote=toggle_quick_terminal
palette = 0=#1d2021
palette = 1=#cc241d
# ... (0-255 supported)
font-family = "JetBrains Mono"
font-family-bold = "JetBrains Mono Bold"
font-size = 14
font-feature = -calt # Disable ligatures
font-feature = -liga
background-opacity = 0.9
background-blur = true # macOS, KDE Plasma only
macOS Only:
window-position-x/y, window-save-state, window-step-resizewindow-vsync, window-colorspacemacos-titlebar-style, toggle_window_float_on_topfont-thicken, font-thicken-strengthtoggle_visibility, undo, , Linux/GTK Only:
window-title-font-family, window-subtitlewindow-titlebar-background/foreground (requires window-theme = ghostty)window-show-tab-bar, gtk-single-instancetoggle_maximize, toggle_window_decorationstoggle_tab_overview, toggle_command_paletteLinux Wayland Only:
quick-terminal-keyboard-interactivitygtk-quick-terminal-layer, gtk-quick-terminal-namespaceFreeType (Linux) Only:
freetype-load-flagsFor complete option and keybinding references, load:
references/options.md - All config options by category (font, colour, window, etc.)references/keybindings.md - All keybinding actions with parametersLoad these when you need specific option details, valid values, or keybinding action syntax.
Weekly Installs
81
Repository
GitHub Stars
113
First Seen
Jan 30, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode78
codex78
gemini-cli76
cursor74
github-copilot73
kimi-cli71
Lark CLI Wiki API 使用指南:获取知识空间节点信息与权限管理
39,100 周安装
| List all available keybinding actions |
ghostty +boo | Easter egg |
redocheck_for_updatesprompt_surface_title