Kitty 终端配置 - Neovide 风格光标拖尾

文章发布时间:

最后更新时间:

文章总字数:
493

页面浏览: 加载中...

受 Neovide 启发,在 Kitty 上实现了光标拖尾动画。GPU 渲染,丝滑流畅。

效果

  • 光标拖尾 - 类 Neovide 粒子特效,Vim 移动时尤为明显
  • 毛玻璃模糊 - 透明度 0.85 + 模糊 30,完美融入 macOS
  • 极致性能 - OpenGL 渲染,输入延迟 < 3ms
  • 现代 Shell - Fish 自动补全 + 语法高亮

Kitty 配置

~/.config/kitty/kitty.conf:

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
# Shell (Apple Silicon)
shell /opt/homebrew/bin/fish --login --interactive

# 字体
font_family FiraCode Nerd Font
font_size 14.0

# 窗口
hide_window_decorations no
macos_titlebar_color background
window_padding_width 5

# 透明度与模糊
background_opacity 0.85
background_blur 30

# 颜色
background #1e1e1e
foreground #ffffff
selection_background #3e4452
selection_foreground #ffffff
url_color #0087bd

# 光标
cursor_shape block
cursor_color #ffffff
cursor_blink_interval 0.5
cursor_stop_blinking_after 0

# Neovide 风格拖尾
cursor_trail 3
cursor_trail_decay 0.1 0.4
cursor_trail_start_threshold 2

# macOS 优化
macos_option_as_alt yes
confirm_os_window_close 0

# 性能
scrollback_lines 10000

Fish 配置

~/.config/fish/config.fish:

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
# 关闭欢迎语
set fish_greeting ""

# Homebrew
if test -f /opt/homebrew/bin/brew
eval (/opt/homebrew/bin/brew shellenv)
end

# 编辑器
set -gx EDITOR nvim
set -gx VISUAL nvim
set -gx COLORTERM truecolor

# 别名
alias vim nvim
alias vi nvim
alias ls "ls -lh --color=auto"
alias ll "ls -lah"
alias gs "git status -s"
alias gap "git add -p"

# 仅交互式加载
if not status is-interactive
exit
end

# 路径
test -d $HOME/.cargo/bin && fish_add_path $HOME/.cargo/bin
test -d $HOME/.bun/bin && fish_add_path $HOME/.bun/bin

调优

光标拖尾强度:

1
2
3
4
5
6
7
8
9
10
11
# 轻量
cursor_trail 2
cursor_trail_decay 0.1 0.3

# 平衡
cursor_trail 3
cursor_trail_decay 0.1 0.4

# 激进
cursor_trail 5
cursor_trail_decay 0.05 0.5

透明度:

1
2
3
4
5
6
7
8
9
10
11
# 清晰
background_opacity 0.95
background_blur 20

# 平衡
background_opacity 0.85
background_blur 30

# 炫酷
background_opacity 0.75
background_blur 40

安装

1
2
3
4
5
6
7
8
9
10
# 依赖
brew install --cask kitty
brew install --cask font-fira-code-nerd-font
brew install fish

# 应用配置
mkdir -p ~/.config/kitty ~/.config/fish
# 复制上面的配置

# 重启 Kitty

常见问题

Fish 滚轮变历史翻页?

1
2
3
# 临时: Shift + 滚轮
# 永久: 禁用鼠标
set -U fish_mouse_disabled 1

光标拖尾不显示?

1
2
# 更新 Kitty (需 0.26.0+)
brew upgrade --cask kitty

Intel Mac?

1
2
# 修改 shell 路径
shell /usr/local/bin/fish --login --interactive

快捷键

1
2
3
4
5
6
Cmd+T          新标签
Cmd+W 关闭标签
Cmd+Enter 分屏
Cmd+F 搜索
Ctrl+Shift+F5 重载配置
Ctrl+Shift+F2 编辑配置

调试

1
2
3
4
5
6
7
8
9
# 查看完整配置
kitty --debug-config

# Fish 绑定
bind

# 版本检查
kitty --version
fish --version