当前版本Ghostty最全配置,可直接复制粘贴到config文件中,重新加载即可启动,希望你有自己最顺手的终端
新手学习 AI应用 相关知识,更新技能与时代为舞,希望能一起入门不断进步 [碱基比特]
前文已经介绍了一下Ghostty软件的下载安装和使用,配置软件的使用,Ghostty灵活性,可操作性和快速流畅是它迅速火起来的根本
这里汇总了一下Ghostty设置,并将配置分类方便查找和使用,按照自己的习惯配置了一份基本覆盖全部设置的配置文件
你可直接将下方配置复制到你的
config文件中,刷新即可
ghostty +show-config --defaultghostty +show-configghostty +list-keybinds --defaultghostty +show-config --default | grep fontstarship和oh My Zsh请查看上一篇的介绍
这里只是粗浅的分类,具体的可以自行改变
#用来注释,有的设置被注释掉了,如有需要直接删除#即可
有的设置参数是true和false,但是有的参数比较复杂,具体还要参考文档
有的设置当前无法使用暂时保留,可用的设置全部验证过了
这里的分屏采用的Tmux逻辑,使用的是先按ctrl+a,然后按l,r,u,d进行上下左右分屏,看个人喜好
光标行为
鼠标行为
背景和分屏行为
keybind--翻页和滚屏设置
搜索设置
终端windows窗口控制
shell设置
自定义命令面板菜单
Linux独有设置
`# Ghostty 主要配置
# 这里提供常用的设置,如果要使用将[#去掉](),并修改设置即可,中文提供简单的说明
# 显示 Ghostty 所有配置项 + 默认值 `ghostty +show-config --default`
# 查看当前生效的配置包含你的修改 `ghostty +show-config`
# 查看默认快捷键(keybings) `ghostty +list-keybinds --default`
# 搜索筛选某个配置:`ghostty +show-config --default | grep font`
app-notifications = clipboard-copy,config-reload
#====================== 字体和渲染设置 =======================
# 语言和字体设置,设置了反而报错所以没有设置
# language = zh
# 字体家族设置,此配置可以重复多次
font-family = FiraCode Nerd Font
# fallback(中文)
font-family = "PingFang SC"
font-family = "Noto Sans CJK SC"
# 一般设定family之后会自动寻找粗体,斜体不需要设定
# font-family-bold =
# font-family-italic =
# font-family-bold-italic =
# 字体形式的设置或者禁用,往往配合字体family使用
# font-style-italic = false
# font-style-bold = "Semibold"
# 允许字体缺乏时合成
font-synthetic-style = bold,italic,bold-italic
# 高级字体特性(font-feature)配置控制字体的 OpenType 功能(开启或禁用),开启后配合下方的font-shaping-break使用
font-feature = calt, liga, dlig
# 字体大小
font-size = 15
# Ghostty 对可变字体(Variable Font)的高级配置
font-variation = "wght=500"
font-variation = "slnt=5"
# Ghostty 的 codepoint 到字体映射(font-codepoint-map)配置对特定 Unicode 字符或符号强制使用某个字体渲染,解决 emoji、特殊符号或图标显示不一致的问题
font-codepoint-map = "U+1F300-U+1F5FF=Apple Color Emoji"
font-codepoint-map = "U+1F600-U+1F64F=Apple Color Emoji"
font-codepoint-map = "U+E0A0-U+E0FF=FiraCode Nerd Font"
# 复制时自动"替换字符"规则,各个领域的替换
clipboard-codepoint-map = "U+2500=U+002D"
clipboard-codepoint-map = "U+2502=U+007C"
clipboard-codepoint-map = "U+2514=U+002B"
clipboard-codepoint-map = "U+2518=U+002B"
clipboard-codepoint-map = "U+03B1=alpha"
clipboard-codepoint-map = "U+03B2=beta"
clipboard-codepoint-map = "U+03B3=gamma"
# 字体粗度
font-thicken = true
font-thicken-strength = 255
# 连字断开显示配合font-feature使用,在光标指时候显示原始的符号比如!=显示
font-shaping-break = cursor
# 字体渲染模式(linear, native, linear-corrected)
alpha-blending = linear-corrected
#========================== 字体微调系统 ============================
# 手动校正字体渲染几何结构,字体 metrics 和终端 cell 不匹配
# cell宽高
adjust-cell-width = 5%
adjust-cell-height = 10%
# 基线baseline调整
adjust-font-baseline = 2
adjust-underline-position = 2
adjust-underline-thickness = 1
# 删除线
adjust-strikethrough-thickness = 1
adjust-strikethrough-position = 0%
# 让光标更清晰、边框更统一、图标更对齐
adjust-cursor-thickness = 1
adjust-cursor-height = 5%
adjust-box-thickness = 1
adjust-icon-height = 10%
# 一个字符占几个格子 legacy或unicode
grapheme-width-method = unicode
# (Linux 专属)控制字体如何渲染
freetype-load-flags = hinting,no-force-autohint,no-monochrome,autohint,light
#===================== 主题选用 ========================
# 主题自选也可以使用别的starship进行搭建
# ghostty +list-themes 查看自带主题
theme = Rose Pine
# 主题选好之后 background, foreground, selection-foreground, selection-background, palette, cursor-color, cursor-text 会全部配好,如果要覆盖可以挨个进行修改
# background = [#RRGGBB]()
# foreground =
# 可在主题上增加背景照片和透明度
background-image =
background-image-opacity =
# 控制背景图片"放在哪个位置对齐" 左上左下等
background-image-position =
# 背景图片怎么布置: 占据整个终端还是包含 contain, cover, stretch, none
background-image-fit = cover
# 控制选中文本时的字体颜色和背景颜色
selection-foreground = [#3b82f6]()
selection-background = [#ffffff]()
# 选中字体后的行为,是否取消选中,复制后是否取消,双击时词的边界
selection-clear-on-typing = true
selection-clear-on-copy = false
selection-word-chars = "\t'\"|`|:;,()[]{}<>$"
# 强制前景色和背景色对比度 1-21,这个设置会修改背景
minimum-contrast = 1
#================== 颜色调配 =======================
# palette 是 Ghostty 里最核心、最底层的配色机制之一,最重要的是前16色,minimum-contrast 会强制覆盖你设置的颜色
# 在设置主题的时候自动生成了,基本不用调整
# palette颜色
[#palette]() = 0=[#26233a]()
[#palette]() = 1=[#eb6f92]()
[#palette]() = 2=[#31748f]()
[#palette]() = 3=[#f6c177]()
[#palette]() = 4=[#9ccfd8]()
[#palette]() = 5=[#c4a7e7]()
# palette-generate 用来从基础的16色生成256,并且有协调功能
palette-generate = false
palette-harmonious = false
#============================== 光标行为 ============================
# 光标颜色
cursor-color = green
# 光标透明度
cursor-opacity = 1
# 光标形式 block, bar, underline, block_hollow
cursor-style = block
# 光标是否闪烁
cursor-style-blink = true
# 光标可以在终端移动
cursor-click-to-move = true
#============== 鼠标行为 =============
# 鼠标打字时隐藏鼠标指针
mouse-hide-while-typing = true
# 自动滚到底部的控制,在终端输出时你可以向上翻看,按键的时候跳转到当前终端,也可以输入的时候跳转终端,也可以纯手动
# keystroke 是按键跳转,output 是自动刷新结果
scroll-to-bottom = keystroke,no-output
# 决定当鼠标选择文字时 Shift 是给终端用,还是给程序用,默认false
mouse-shift-capture = false
# 是否允许程序"接管鼠标" 默认true
mouse-reporting = true
# 滚轮一次滚多远,标准滚轮 discrete,高精度 discrete
mouse-scroll-multiplier = precision:0.7,discrete:4
#==================== 背景和分屏行为 =======================
# 终端透明度
background-opacity = 0.9
# 所有背景包括程序终端透明
background-opacity-cells = true
# 给透明背景加"模糊滤镜",能不能看到终端背后的文字,可选true false和数值
background-blur = 10
# 分屏split使用,未选中的分屏变淡多少 0.5-1
unfocused-split-opacity = 0.75
# 未选中分屏变暗的颜色是什么
unfocused-split-fill = "[#0A0F1C]()"
# 分屏之间的分隔线颜色
split-divider-color = "[#444444]()"
# 切换窗口时,是否保持"放大状态"
split-preserve-zoom = navigation
# 搜索高亮颜色配置
search-foreground = "[#000000]()"
search-background = "[#FFD54F]()"
search-selected-foreground = "[#000000]()"
search-selected-background = "[#FF7043]()"
#====================== 命令和通知 ============================
# 每次打开窗口时执行的命令--指定shell
command = zsh
# 第一次打开ghostty执行的命令
[#initial]()-command = nvim
# 命令结束后提醒
notify-on-command-finish = unfocused
# 通知方式
notify-on-command-finish-action = no-bell,notify
# 时间阈值,超过多长的命令执行才提醒
notify-on-command-finish-after = 10s
# 给终端里运行的所有程序"注入环境变量"
[#env]() =
# 终端启动后,自动"帮你输入一段内容",可设置pathway等
[#input]() = echo 恭喜你,设置成功Ghostty!
# 程序结束后,终端要不要立刻关闭
wait-after-command = true
# 判断程序是不是在约定的时间内闪退,秒退提示异常
abnormal-command-exit-runtime = 250
#================= 滚动屏幕和链接link设置 ================
# 历史滚动缓冲区最多占用多少内存(字节)
scrollback-limit = 200000000
# 侧边滚动条
scrollbar = system
# 点击link跳转
link-url = true
# link-previews预览
link-previews = true
# link正则匹配+点击触发动作,包括不限于本地点击,localhost服务,IP服务等,暂时ghostty无法配置
[#link]() = regex="localhost:[0-9]+" action="open"
[#link]() = regex="http://[0-9\\.]+:[0-9]+" action="open"
[#link]() = regex="(/var/log/[^ ]+)" action="open"
[#link]() = regex="(/[^ ]+\\.(py|js|ts|json))" action="open"
# 新建窗口最大化
maximize = false
# 新建窗口是否全屏
fullscreen = false
# 窗口标题
title = ""
# class中更改应用程序的类名/ID,适用于Linux
# class = "com.mycompany.terminal"
# 终端启动后默认文件夹,默认是继承启动进程的工作目录,默认是home
[#working]()-directory = "inherit"
#============= keybind 字体屏幕和命令终端设置 ================
# ghostty +list-actions 用来查看action命令
# super 为 command,ctrl 为 control,alt 为 option
# 前缀:all 表示所有窗口一起执行;global 全系统生效;unconsumed 不触发的键传给 shell;performable 条件触发
# ignore 忽略;unbind 取消绑定;text 发送文本;csi 控制序列;esc 序列
# 重新载入config
keybind = global:super+shift+,=reload_config
# 打开config
keybind = global:super+,=open_config
# 设置复制粘贴的选项,mixed 表示未选中复制内容时粘贴上一次复制的内容
keybind = copy=copy_to_clipboard:mixed
keybind = paste=paste_from_clipboard
keybind = performable:super+c=copy_to_clipboard:mixed
keybind = performable:super+v=paste_from_clipboard
# 强制性粘贴
keybind = super+shift+v=paste_from_selection
# 选中内容后精准选择文字
keybind = shift+arrow_left=adjust_selection:left
keybind = shift+arrow_right=adjust_selection:right
keybind = shift+arrow_up=adjust_selection:up
keybind = shift+arrow_down=adjust_selection:down
# 增加减小字体
keybind = super+==increase_font_size:1
keybind = super++=increase_font_size:1
keybind = super+-=decrease_font_size:1
keybind = super+0=reset_font_size
# 全屏快捷键
keybind = super+enter=toggle_fullscreen
# 命令面板
keybind = super+shift+p=toggle_command_palette
# 离开程序
keybind = super+q=quit
# 撤销上一步的操作
keybind = super+z=undo
keybind = super+shift+z=redo
# 检查模式
keybind = super+alt+i=inspector:toggle
## 通过发送字节来控制
# 光标向左跳过一个单词
keybind = alt+arrow_left=esc:b
# 光标向右跳过一个单词
keybind = alt+arrow_right=esc:f
# 跳到命令行首
# super+arrow_left
# 跳到行尾
# super+arrow_right
#============== keybind 翻页和滚屏设置 =================
# 快速滚屏操作
keybind = super+up=scroll_to_top
keybind = super+down=scroll_to_bottom
# 用来读存取当前屏幕上的日志,设置非常反人类,可参考
keybind = super+ctrl+shift+j=write_screen_file:copy,plain
keybind = super+shift+j=write_screen_file:paste,plain
keybind = super+alt+shift+j=write_screen_file:open,plain
# 翻页式的滚动
keybind = super+shift+arrow_up=jump_to_prompt:-1
keybind = super+shift+arrow_down=jump_to_prompt:1
# 智能回看键 主要是选中后能够快速返回正在看的位置,j用journal
keybind = super+j=scroll_to_selection
#================ tab 设置 ==========================
# tab增删切换
# 新增tab
keybind = super+t=new_tab
keybind = super+shift+[=previous_tab
keybind = super+shift+]=next_tab
keybind = ctrl+tab=next_tab
# 切换tab顺序
keybind = super+digit_1=goto_tab:1
keybind = super+1=goto_tab:1
keybind = super+digit_2=goto_tab:2
keybind = super+2=goto_tab:2
keybind = super+digit_3=goto_tab:3
keybind = super+3=goto_tab:3
keybind = super+digit_4=goto_tab:4
keybind = super+4=goto_tab:4
keybind = super+digit_5=goto_tab:5
keybind = super+5=goto_tab:5
keybind = super+digit_6=goto_tab:6
keybind = super+6=goto_tab:6
keybind = super+digit_7=goto_tab:7
keybind = super+7=goto_tab:7
keybind = super+digit_8=goto_tab:8
keybind = super+8=goto_tab:8
keybind = super+9=last_tab
# 关闭tab
keybind = super+alt+w=close_tab:this
# 撤销关闭的tab
keybind = super+shift+t=undo
#====================== windows和分屏操作 ========================
# windows切换
keybind = super+n=new_window
# 关闭全部程序
keybind = super+w=close_surface
# 关闭windows
keybind = super+shift+w=close_window
# 参考tmux 先ctrl+a等待后续输入操作
keybind = ctrl+a>r=new_split:right
keybind = ctrl+a>l=new_split:left
keybind = ctrl+a>d=new_split:down
keybind = ctrl+a>u=new_split:up
keybind = super+[=goto_split:previous
keybind = super+]=goto_split:next
# 切换不同的分屏,可用鼠标点击
keybind = super+alt+arrow_up=goto_split:up
keybind = super+alt+arrow_down=goto_split:down
keybind = super+alt+arrow_left=goto_split:left
keybind = super+alt+arrow_right=goto_split:right
# 改变分屏的大小,也可用鼠标点击
keybind = super+ctrl+arrow_up=resize_split:up,10
keybind = super+ctrl+arrow_down=resize_split:down,10
keybind = super+ctrl+arrow_left=resize_split:left,10
keybind = super+ctrl+arrow_right=resize_split:right,10
# 强迫症福音 同样大的分屏
keybind = super+ctrl+==equalize_splits
#=================== 搜索设置 ======================
# 开启搜索
keybind = super+f=start_search
# 光标选中后直接搜索选中的,e可以理解为词目entry
keybind = super+e=search_selection
# 关闭搜索,鼠标也可以
keybind = super+shift+f=end_search
keybind = escape=end_search
# 跳转下页搜索
keybind = super+g=navigate_search:next
keybind = super+shift+g=navigate_search:previous
#================== 终端windows窗口控制 =====================
# 控制终端内容离窗口边框的"留白",重启终端才能生效
window-padding-x = 10
window-padding-y = 10
# 均匀分散空间
window-padding-balance = true
# 背景填充的颜色
window-padding-color = extend
# 渲染与屏幕刷新同步
window-vsync = true
# 新窗口是否继承当前文档 true或false
window-inherit-working-directory = true
tab-inherit-working-directory = true
# 新窗口字体大小继承
window-inherit-font-size = false
window-decoration = auto
# mac想隐藏标题
[#macos]()-titlebar-style = hidden
# 字体
window-title-font-family =
# 副标题
window-subtitle =
# 新打开的大小窗口
window-width = 120
window-height = 30
# 控制初始位置 像素
window-position-x = 100
window-position-y = 50
# 其他设置
# 是否记住上次windows的状态
window-save-state = always
window-step-resize = true
window-new-tab-position = current
window-show-tab-bar = auto
window-titlebar-background =
window-titlebar-foreground =
# 拖拽窗口大小提示终端尺寸
# 什么时候显示
resize-overlay = always
# 显示在哪里
resize-overlay-position = center
# 显示多久
resize-overlay-duration = 1s
# 关闭窗口提醒确认
confirm-close-surface = true
# 关闭最后一个窗口后彻底退出
quit-after-last-window-closed = true
# Linux有效
quit-after-last-window-closed-delay =
# 启动ghostty是否创建一个新的窗口
initial-window = true
# 执行的操作(如关闭窗口、标签页)在多久之内可以通过 Cmd+Z 撤销
undo-timeout = 5s
# 快捷唤起ghostty
keybind = cmd+`=toggle_quick_terminal
quick-terminal-position = top
quick-terminal-size = 30%
# 当你把快速终端拉出来时,它应该盖住谁
gtk-quick-terminal-layer = top
gtk-quick-terminal-namespace = ghostty-quick-terminal
#================ 鼠标和系统剪贴板安全设置 ===================
# 鼠标移动到区域是否激活
focus-follows-mouse = false
# 是否允许终端里的程序读取系统剪贴板的内容
clipboard-write = ask
# 是否允许终端里的程序向系统剪贴板写入内容
clipboard-write = allow
# 是否自动去掉行尾的空格
clipboard-trim-trailing-spaces = true
# 粘贴保护
clipboard-paste-protection = true
clipboard-paste-bracketed-safe = true
# 是否允许程序查询终端的标题
title-report = false
# 图片存储限制
image-storage-limit = 320000000
# 选中后按鼠标中键复制粘贴
copy-on-select = true
# 右键的设置
right-click-action = context-menu
# config file设置
# 允许你引入其他的配置文件
# config-file = "theme.ghostty"
# config-file = "?optional.ghostty"
config-default-files = true
#==================== shell设置 ==========================
# shell检测
shell-integration = detect
# no-前缀来禁用某项,功能增强
shell-integration-features = cursor,sudo,title,no-ssh-env,no-ssh-terminfo,path
#================== 自定义命令面板菜单 ================
# 命令面板(通常通过快捷键唤起)就像一个"搜索栏",让你不用记复杂的快捷键就能执行各种操作,本身有命令为了区分+[My]
# SSH,记得修改成自己的服务器
[#command]()-palette-entry = title:"[OPS] SSH Prod", action:"new_window: ssh user@prod-server"
# Claude打开
[#command]()-palette-entry = title:"[AI] Claude Code", action:"new_window: claude"
# 切换目录
[#command]()-palette-entry = title:"[DEV] Open AI Project", action:"new_window: cd ~/ai-hedge-fund && zsh"
#======================== MacOS独有设置 =========================
# 配置主要涉及 Quick Terminal(快速终端)的高级行为
# 快速终端应该在哪个显示器上弹出 main, mouse
# quick-terminal-screen = main
# 控制终端滑出和收回的动画时间(秒)
quick-terminal-animation-duration = 0.2
# 失焦自动隐藏
quick-terminal-autohide = true
quick-terminal-space-behavior = move
quick-terminal-keyboard-interactivity = on-demand
# 标题风格
macos-titlebar-style = native
# 非原生屏
macos-non-native-fullscreen = false
# 窗口红绿黄按钮
macos-window-buttons = visible
# 文件拖到dock后续行动
macos-dock-drop-behavior = new-tab
# 窗口阴影
macos-window-shadow = true
macos-hidden = never
macos-applescript = true
#================= Linux独有设置 ==========================
# 每个终端标签页/分屏放入独立的 systemd 作用域(Scope)中
linux-cgroup = never
# 单个终端进程(如一个分屏)最多能用多少内存,进程,失败处理
linux-cgroup-memory-limit =
linux-cgroup-processes-limit =
linux-cgroup-hard-fail = false
# Linux控制 Ghostty 的窗口管理行为、外观样式(CSS)以及资源管理模式
# 开启或关闭 GTK 的 OpenGL 调试日志
gtk-opengl-debug = false
# 决定了新启动的 Ghostty 进程是新建窗口还是新建独立应用
gtk-single-instance = detect
gtk-titlebar = true
gtk-tabs-location = top
gtk-titlebar-hide-when-maximized = false
gtk-toolbar-style = raised
gtk-titlebar-style = native
gtk-wide-tabs = true
gtk-custom-css =
# Linux 平台下非常底层的I/O引擎
async-backend = auto
desktop-notifications = true
progress-style = true
bold-color =
faint-opacity = 0.5
term = xterm-ghostty
enquiry-response =
async-backend = auto`
萝卜青菜各有所爱,仅供参考,并不需要记住这么多,只要常用常查形成肌肉记忆即可,希望每个人都有自己最顺手的终端,快速提升效率
本文转载自微信公众号,如有侵权请联系删除。