自从沉迷 nvim 依赖,更换过很多终端模拟器,这次给大家分享一个新的终端 Ghostty,可玩性很高。
按照惯例先来几张图,吸引一下:
配置详情
配置也很简单,基础配置放在 ~/.config/ghostty/config
文件里。
配置文件修改需要重新载入,部分配置仅支持新窗口、新标签页。
可使用 Ctrl + Shift + ,
快速重载配置。
字体配置
font-family = FiraCode Nerd Font Mono font-family = Symbols Nerd Font Mono font-family = PingFang SC
font-feature = FiraCode-Retina font-feature = +zero
font-feature = calt font-feature = liga font-feature = ss13 font-codepoint-map = U+4E00-U+9FFF=Sarasa Mono SC Regular font-codepoint-map = U+3400-U+4DBF=Sarasa Mono SC Regular font-size = 13 font-thicken = true
window-inherit-font-size = true
|
窗口设置
window-height = 30 window-width = 100
|
美化
adjust-cursor-thickness = 3 adjust-underline-position = 3 bold-is-bright = true cursor-invert-fg-bg = true cursor-opacity = 0.8 cursor-style = bar link-url = true mouse-hide-while-typing = true window-vsync = true background-opacity = 0.9 background-blur = true
|
其他配置
clipboard-paste-protection = true clipboard-trim-trailing-spaces = true copy-on-select = true macos-auto-secure-input = true macos-secure-input-indication = true macos-titlebar-style = tabs macos-option-as-alt = true quit-after-last-window-closed = true scrollback-limit = 4200 shell-integration = zsh shell-integration-features = cursor,sudo,title
|
按键绑定
keybind = ctrl+h=goto_split:left keybind = ctrl+j=goto_split:bottom keybind = ctrl+k=goto_split:top keybind = ctrl+l=goto_split:right keybind = ctrl+shift+h=new_split:left keybind = ctrl+shift+j=new_split:down keybind = ctrl+shift+k=new_split:up keybind = ctrl+shift+l=new_split:right keybind = super+shift+enter=new_split:auto keybind = super+shift+i=inspector:toggle keybind = super+shift+r=reload_config keybind = super+t=new_tab
|
配置的内容只简单的修改了一些字体和样式,快捷键也只配置了几个管理 tab 和窗口的。
特效
Ghostty 支持自定义着色器,可以给窗口增加很多特效,我也是被光标动画这个着色器吸引来的。
下载已有的 Shader
这里我推荐 https://github.com/hackr-sh/ghostty-shaders.git
git submodule add https://github.com/hackr-sh/ghostty-shaders.git ~/.config/ghostty/shaders
|
自定义 Shader
custom-shader-animation = always
|
主题配置
主题配置文件在 ~/.config/ghostty/themes
下,创建 tokyonight_day
和 tokyonight_night
两个文件,也可以是别的名字,只要在配置中对应即可,在这里提供一套黑白主题。
tokyonight_day
palette = 0=#b4b5b9 palette = 1=#f52a65 palette = 2=#587539 palette = 3=#8c6c3e palette = 4=#2e7de9 palette = 5=#9854f1 palette = 6=#007197 palette = 7=#6172b0 palette = 8=#a1a6c5 palette = 9=#ff4774 palette = 10=#5c8524 palette = 11=#a27629 palette = 12=#358aff palette = 13=#a463ff palette = 14=#007ea8 palette = 15=#3760bf
background = foreground = cursor-color = selection-background = selection-foreground =
|
tokyonight_night
palette = 0=#15161e palette = 1=#f7768e palette = 2=#9ece6a palette = 3=#e0af68 palette = 4=#7aa2f7 palette = 5=#bb9af7 palette = 6=#7dcfff palette = 7=#a9b1d6 palette = 8=#414868 palette = 9=#ff899d palette = 10=#9fe044 palette = 11=#faba4a palette = 12=#8db0ff palette = 13=#c7a9ff palette = 14=#a4daff palette = 15=#c0caf5
background = foreground = cursor-color = selection-background = selection-foreground =
|
配置内容
在配置文件的 Look and Feel
里增加一行配置。
theme = dark:tokyonight_night,light:tokyonight_day
|
当然如果你想一直使用同一个配色,把 dark 和 light 配置成一样就行了。
完整配置
font-family = FiraCode Nerd Font Mono font-family = Symbols Nerd Font Mono font-family = PingFang SC
font-feature = FiraCode-Retina font-feature = +zero
font-feature = calt font-feature = liga font-feature = ss13 font-codepoint-map = U+4E00-U+9FFF=Sarasa Mono SC Regular font-codepoint-map = U+3400-U+4DBF=Sarasa Mono SC Regular font-size = 13 font-thicken = true
window-inherit-font-size = true
window-height = 30 window-width = 100
adjust-cursor-thickness = 3 adjust-underline-position = 3 bold-is-bright = true cursor-invert-fg-bg = true cursor-opacity = 0.8 cursor-style = bar link-url = true mouse-hide-while-typing = true theme = dark:tokyonight_night,light:tokyonight_night window-vsync = true background-opacity = 0.9 background-blur = true
custom-shader-animation = always
custom-shader = shaders/cursor_blaze.glsl
custom-shader = shaders/just-snow.glsl
clipboard-paste-protection = true clipboard-trim-trailing-spaces = true copy-on-select = true macos-auto-secure-input = true macos-secure-input-indication = true macos-titlebar-style = tabs macos-option-as-alt = true quit-after-last-window-closed = true scrollback-limit = 4200 shell-integration = zsh shell-integration-features = cursor,sudo,title
keybind = ctrl+h=goto_split:left keybind = ctrl+j=goto_split:bottom keybind = ctrl+k=goto_split:top keybind = ctrl+l=goto_split:right keybind = ctrl+shift+h=new_split:left keybind = ctrl+shift+j=new_split:down keybind = ctrl+shift+k=new_split:up keybind = ctrl+shift+l=new_split:right keybind = super+shift+enter=new_split:auto keybind = super+shift+i=inspector:toggle keybind = super+shift+r=reload_config keybind = super+t=new_tab
|