当前版本Ghostty最全配置(易上手)

lxiol
📝
当前版本Ghostty最全配置,可直接复制粘贴到config文件中,重新加载即可启动,希望你有自己最顺手的终端 新手学习 AI应用 相关知识,更新技能与时代为舞,希望能一起入门不断进步 碱基比特 前文已经介绍了一下Ghostty软件的下载安装和使用https:/

原文链接:https://mp.weixin.qq.com/s/dC5kF1xUFun8iMBd6o-UNQ

当前版本Ghostty最全配置,可直接复制粘贴到config文件中,重新加载即可启动,希望你有自己最顺手的终端

新手学习 AI应用 相关知识,更新技能与时代为舞,希望能一起入门不断进步 [碱基比特]

前文已经介绍了一下Ghostty软件的下载安装和使用,配置软件的使用,Ghostty灵活性,可操作性和快速流畅是它迅速火起来的根本

这里汇总了一下Ghostty设置,并将配置分类方便查找和使用,按照自己的习惯配置了一份基本覆盖全部设置的配置文件

你可直接将下方配置复制到你的config文件中,刷新即可

1. Ghostty本身设置查看

  • 显示 Ghostty 所有配置项 + 默认值 ghostty +show-config --default
  • 查看当前生效的配置包含你的修改 ghostty +show-config
  • 查看默认快捷键(keybings) ghostty +list-keybinds --default
  • 搜索筛选某个配置:ghostty +show-config --default | grep font

starshipoh My Zsh请查看上一篇的介绍

2. 设置分类

这里只是粗浅的分类,具体的可以自行改变

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
`# 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`

萝卜青菜各有所爱,仅供参考,并不需要记住这么多,只要常用常查形成肌肉记忆即可,希望每个人都有自己最顺手的终端,快速提升效率

本文转载自微信公众号,如有侵权请联系删除。

  • 标题: 当前版本Ghostty最全配置(易上手)
  • 作者: lxiol
  • 创建于 : 2026-04-19 22:03:46
  • 更新于 : 2026-05-12 16:47:34
  • 链接: https://blog.lxiol.cn/2026/04/19/当前版本Ghostty最全配置易上手/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
目录
当前版本Ghostty最全配置(易上手)