Kitty 终端中文文档

文章发布时间:

最后更新时间:

文章总字数:
3.8k

页面浏览: 加载中...

Kitty 终端模拟器

Kitty 是一款基于 GPU 加速 的终端模拟器,具有极高的性能和丰富的功能。它使用 OpenGL 进行渲染,能够处理大量的终端输出,同时保持流畅的滚动和输入响应。本文档是 Kitty 官方文档的完整中文翻译和整理,涵盖从入门到精通的所有内容。

📋 文档目录


快速开始

安装

macOS:

1
brew install --cask kitty

Linux:

1
2
3
4
5
6
7
8
# Ubuntu/Debian
sudo apt install kitty

# Fedora
sudo dnf install kitty

# Arch
sudo pacman -S kitty

通用安装脚本:

1
curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin

首次启动

1
kitty

配置文件位于: ~/.config/kitty/kitty.conf

基本快捷键

操作 快捷键
新建标签页 Ctrl+Shift+T
关闭标签页 Ctrl+Shift+Q
切换标签页 Ctrl+Shift+←/→
新建窗口 Ctrl+Shift+Enter
切换窗口 Ctrl+Shift+]/[
切换布局 Ctrl+Shift+L
复制 Ctrl+Shift+C
粘贴 Ctrl+Shift+V
放大字体 Ctrl+Shift++
缩小字体 Ctrl+Shift+-
重置字体 Ctrl+Shift+0
搜索 Ctrl+Shift+F
重载配置 Ctrl+Shift+F5
编辑配置 Ctrl+Shift+F2

快速配置

1
2
3
4
5
6
7
8
9
mkdir -p ~/.config/kitty
cat > ~/.config/kitty/kitty.conf << 'EOF'
font_family JetBrains Mono
font_size 14.0
window_padding_width 4
enabled_layouts tall,fat,grid,stack
tab_bar_style powerline
background_opacity 0.95
EOF

核心概念

GPU 加速

Kitty 使用 GPU (OpenGL) 进行渲染,带来:

  • 极低输入延迟
  • 零撕裂滚动
  • 海量输出不卡顿

Tabs vs Windows

标签页 (Tabs): 独立会话,类似浏览器标签

  • Ctrl+Shift+T 新建
  • Ctrl+Shift+←/→ 切换

窗口 (Windows): 同一标签页内的分屏

  • Ctrl+Shift+Enter 新建
  • 可同时看到多个终端输出

窗口布局

  • Tall: 主窗口在左,其他在右垂直堆叠
  • Fat: 主窗口在上,其他在下水平排列
  • Grid: 网格均匀分布
  • Stack: 全屏堆叠显示(类似 tmux zoom)
  • Splits: 自由分割(类似 tmux/vim 的分屏)
  • Horizontal: 水平分割
  • Vertical: 垂直分割

配置参考

基本语法

1
2
3
# 注释
option_name value
include other.conf

字体配置

1
2
3
4
5
6
7
8
font_family JetBrains Mono
font_size 14.0
bold_font auto
italic_font auto
disable_ligatures cursor

# Nerd Fonts 符号映射
symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols

光标配置

1
2
3
4
5
cursor_shape beam          # block, beam, underline
cursor_blink_interval 0.5
cursor_stop_blinking_after 15.0
cursor_color #ff0000
cursor_text_color #ffffff

滚动配置

1
2
3
scrollback_lines 100000
scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS
wheel_scroll_multiplier 5.0

鼠标配置

1
2
3
4
5
mouse_hide_wait 3.0
url_color #0087bd
url_style curly
open_url_modifiers kitty_mod
copy_on_select no

性能调优

1
2
3
4
repaint_delay 10
input_delay 3
sync_to_monitor yes
enable_audio_bell no

窗口布局配置

1
2
3
4
5
6
enabled_layouts tall,fat,grid,splits,stack
window_border_width 1
window_margin_width 0
window_padding_width 4
active_border_color #00ff00
inactive_border_color #cccccc

标签页栏配置

1
2
3
tab_bar_style powerline
tab_bar_align left
tab_title_template "{index}: {title}"

颜色配置

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
foreground #a9b1d6
background #1a1b26
selection_foreground #1a1b26
selection_background #a9b1d6
cursor #a9b1d6

# 16色调色板
color0 #15161e
color1 #f7768e
color2 #9ece6a
color3 #e0af68
color4 #7aa2f7
color5 #bb9af7
color6 #7dcfff
color7 #a9b1d6
color8 #414868
color9 #f7768e
color10 #9ece6a
color11 #e0af68
color12 #7aa2f7
color13 #bb9af7
color14 #7dcfff
color15 #c0caf5

# 背景透明
background_opacity 0.95
dynamic_background_opacity yes

键盘映射

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
kitty_mod ctrl+shift

# 窗口管理
map kitty_mod+enter new_window
map kitty_mod+shift+enter new_window_with_cwd
map kitty_mod+w close_window
map kitty_mod+] next_window
map kitty_mod+[ previous_window

# 标签页管理
map kitty_mod+t new_tab
map kitty_mod+shift+t new_tab_with_cwd
map kitty_mod+q close_tab
map kitty_mod+right next_tab
map kitty_mod+left previous_tab
map kitty_mod+1 goto_tab 1
map kitty_mod+2 goto_tab 2

# 滚动
map kitty_mod+k scroll_line_up
map kitty_mod+j scroll_line_down
map kitty_mod+u scroll_page_up
map kitty_mod+d scroll_page_down

# 复制粘贴
map kitty_mod+c copy_to_clipboard
map kitty_mod+v paste_from_clipboard
map kitty_mod+shift+v paste_from_selection

# 字体调整
map kitty_mod+plus increase_font_size
map kitty_mod+minus decrease_font_size
map kitty_mod+0 restore_font_size

# 搜索
map kitty_mod+f show_scrollback
map kitty_mod+h show_scrollback

# 窗口调整
map kitty_mod+r start_resizing_window
map kitty_mod+alt+h resize_window narrower
map kitty_mod+alt+l resize_window wider
map kitty_mod+alt+k resize_window taller
map kitty_mod+alt+j resize_window shorter
map kitty_mod+home resize_window reset

# 其他
map kitty_mod+f5 load_config_file
map kitty_mod+f2 edit_config_file
map kitty_mod+shift+delete clear_terminal reset active
map kitty_mod+f11 toggle_fullscreen
map kitty_mod+u kitten unicode_input
map kitty_mod+f kitten hints

高级配置

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
# 环境变量
env PATH=${HOME}/bin:${PATH}

# Shell
shell /bin/bash
shell_integration enabled

# 远程控制
allow_remote_control yes
listen_on unix:/tmp/kitty

# 启动会话
startup_session none

# 关闭窗口确认
confirm_os_window_close 0

# 自动更新检查
update_check_interval 24

# 剪贴板安全
clipboard_control write-clipboard write-primary read-clipboard read-primary

# macOS 特定
macos_option_as_alt no
macos_titlebar_color system
macos_quit_when_last_window_closed yes
macos_show_window_title_in all

# Linux 输入法
linux_display_server auto

# Wayland
wayland_titlebar_color system

# 通知
enable_audio_bell no
visual_bell_duration 0.0
window_alert_on_bell yes
bell_on_tab "🔔 "
command_on_bell none

布局系统

快捷键

1
2
3
4
5
6
map kitty_mod+l next_layout
map kitty_mod+shift+l previous_layout
map kitty_mod+shift+1 goto_layout tall
map kitty_mod+shift+2 goto_layout fat
map kitty_mod+shift+3 goto_layout grid
map kitty_mod+shift+4 goto_layout stack

布局特定配置

1
2
3
tall_layout_bias 0.5
tall_layout_nmasters 1
fat_layout_bias 0.5

快捷键与动作

窗口管理

动作 快捷键示例
new_window kitty_mod+enter
new_window_with_cwd kitty_mod+shift+enter
close_window kitty_mod+w
next_window kitty_mod+]
previous_window kitty_mod+[
goto_window kitty_mod+1
neighboring_window kitty_mod+方向键

标签页管理

动作 快捷键示例
new_tab kitty_mod+t
close_tab kitty_mod+q
next_tab kitty_mod+right
previous_tab kitty_mod+left
goto_tab kitty_mod+数字

组合动作

1
map f1 combine : new_window : set_window_title "Editor"

条件动作

1
map f1 --when-focus-on=title:vim send_key esc

搜索与导航

搜索功能

Kitty 内置强大的搜索功能,支持正则表达式。

快捷键:

1
map kitty_mod+f show_scrollback

搜索操作:

  • Ctrl+Shift+F - 打开搜索
  • Enter / Ctrl+N - 下一个匹配
  • Shift+Enter / Ctrl+P - 上一个匹配
  • Esc - 关闭搜索

高级搜索:

1
2
# 在滚动缓冲区中搜索并用外部工具处理
kitty @ scroll-window --match "error"

文本标记 (Marks)

在输出中创建书签,快速跳转。

1
2
3
4
5
# 创建标记
map kitty_mod+shift+m create_marker

# 移除标记
map kitty_mod+shift+backspace remove_marker

跳转到提示符

配合 Shell 集成使用:

1
2
map kitty_mod+z scroll_to_prompt -1   # 上一个提示符
map kitty_mod+x scroll_to_prompt 1 # 下一个提示符

Shell 集成

Kitty 提供深度的 shell 集成功能,提升终端体验。

启用方式

1
shell_integration enabled

或按需启用特定功能:

1
shell_integration no-cursor no-title no-cwd

功能特性

1. 命令状态指示

  • 自动在提示符旁显示上一个命令的执行状态
  • 成功显示绿色标记,失败显示红色标记

2. 当前工作目录跟踪

  • Kitty 自动跟踪每个窗口的当前目录
  • 新建窗口/标签页可继承当前目录

3. 跳转到命令输出

1
2
3
4
5
6
# 跳转到上/下一个命令提示符
map kitty_mod+z scroll_to_prompt -1
map kitty_mod+x scroll_to_prompt 1

# 跳转到上/下一个命令输出
map kitty_mod+g scroll_to_prompt 0

4. 复制命令输出

  • 快速选择并复制上一个命令的输出
1
2
# 使用 hints kitten 选择命令输出
map kitty_mod+p>y kitten hints --type linenum --linenum-action copy

5. 智能克隆

1
2
3
# 在相同目录打开新窗口
map kitty_mod+enter new_window_with_cwd
map kitty_mod+t new_tab_with_cwd

支持的 Shell

  • Bash: 添加到 ~/.bashrc
  • Zsh: 添加到 ~/.zshrc
  • Fish: 自动支持

手动启用 (Bash/Zsh):

1
2
3
4
5
# 添加到 shell rc 文件
if test -n "$KITTY_INSTALLATION_DIR"; then
export KITTY_SHELL_INTEGRATION="enabled"
source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"
fi

禁用特定功能

1
2
3
4
5
6
7
8
9
10
11
# 禁用光标形状同步
shell_integration no-cursor

# 禁用标题同步
shell_integration no-title

# 禁用当前目录同步
shell_integration no-cwd

# 完全禁用
shell_integration disabled

Kittens 扩展

icat - 图像显示

1
2
kitty +kitten icat image.png
kitty +kitten icat --place 100x100 image.png

ssh - 便捷SSH

1
kitty +kitten ssh user@host

themes - 主题切换

1
2
kitty +kitten themes
kitty +kitten themes --reload-in=all Dracula

hints - 文本选择

1
2
kitty +kitten hints --type url --program default
kitty +kitten hints --type path --program default

diff - 差异比较

1
2
kitty +kitten diff file1.txt file2.txt
kitty +kitten diff -r dir1/ dir2/

transfer - 文件传输

1
kitty +kitten transfer local_file.txt

clipboard - 剪贴板

1
2
echo "text" | kitty +kitten clipboard
kitty +kitten clipboard --get-clipboard

broadcast - 广播输入

1
kitty +kitten broadcast --all

panel - 浮动面板

1
kitty +kitten panel --edge=top htop

unicode_input - Unicode输入

1
2
kitty +kitten unicode_input
kitty +kitten unicode_input heart

hyperlinked_grep - 超链接grep

支持点击跳转的 grep 搜索。

1
2
kitty +kitten hyperlinked_grep "pattern" /path/to/files
kitty +kitten hyperlinked_grep -r "TODO" .

ask - 交互式询问

在终端中显示交互式问题。

1
kitty +kitten ask "Are you sure?" --type yesno

query_terminal - 查询终端

查询终端的能力和状态。

1
kitty +kitten query_terminal

show_key - 显示按键

调试键盘映射,显示按键事件。

1
kitty +kitten show_key

resize_window - 调整窗口

交互式调整窗口大小。

1
kitty +kitten resize_window

自定义 Kitten

创建自己的 kitten 扩展:

1
2
3
4
5
6
7
8
# ~/.config/kitty/custom_kitten.py
from kitty.boss import Boss

def main(args):
pass

def handle_result(args, answer, target_window_id, boss):
pass

使用:

1
kitty +kitten custom_kitten.py

性能优化

渲染性能

1
2
3
4
5
6
7
8
9
10
11
# 降低重绘延迟(提高响应速度,但可能增加CPU使用)
repaint_delay 10

# 降低输入延迟
input_delay 3

# 同步到显示器刷新率
sync_to_monitor yes

# 减少内存使用
scrollback_lines 10000

字体渲染优化

1
2
3
4
5
# 禁用连字以提升性能
disable_ligatures always

# 文本渲染方式 (legacy, platform, freetype)
text_composition_strategy platform

最大化性能配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 高性能配置
repaint_delay 5
input_delay 1
sync_to_monitor yes
scrollback_lines 50000

# 禁用不必要的功能
enable_audio_bell no
visual_bell_duration 0.0
window_alert_on_bell no

# 字体优化
disable_ligatures cursor
text_composition_strategy platform

调试性能问题

1
2
3
4
5
6
7
8
9
# 查看性能统计
kitty --debug-rendering

# 查看配置加载时间
kitty --debug-config

# 生成性能日志
kitty --start-as=normal --override allow_remote_control=yes
kitty @ debug-config

常见问题

特殊符号显示问题

1
symbol_map U+E0A0-U+E0A3 PowerlineSymbols

Emoji显示方块

1
2
3
4
5
# Ubuntu
sudo apt install fonts-noto-color-emoji

# 配置
symbol_map U+1F600-U+1F64F Noto Color Emoji

透明背景不生效(Linux)

1
picom -b

Vim快捷键冲突

1
map --when-focus-on=title:vim kitty_mod+h no_op

SSH连接显示异常

1
kitty +kitten ssh user@host

中文输入问题

Linux (Fcitx):

1
2
3
export GLFW_IM_MODULE=fcitx
# 或在配置文件中设置
# linux_display_server auto

Linux (iBus):

1
export GLFW_IM_MODULE=ibus

性能问题排查

1
2
3
4
5
6
7
8
# 检查渲染性能
kitty --debug-rendering

# 查看配置问题
kitty --debug-config

# 生成详细日志
kitty --verbose

字体渲染模糊

macOS:

1
2
macos_thicken_font 0.5
text_composition_strategy legacy

Linux:

1
2
# 调整字体提示
font_features JetBrainsMono-Regular +zero +cv01

快捷键不生效

1
2
3
4
5
# 检查是否被系统占用
kitty +kitten show_key

# 查看当前映射
kitty --debug-keyboard

GPU 相关问题

1
2
3
4
5
# 强制使用软件渲染(解决驱动问题)
KITTY_DISABLE_WAYLAND=1 kitty

# 指定 OpenGL 版本
KITTY_GL_VERSION=3.3 kitty

远程会话显示问题

使用 SSH kitten 而不是普通 SSH:

1
kitty +kitten ssh user@host

这会自动传输 terminfo 并处理各种兼容性问题。

剪贴板不工作

1
2
# 确保剪贴板控制已启用
clipboard_control write-clipboard write-primary read-clipboard-ask read-primary-ask

光标显示异常

1
2
3
cursor_shape block
cursor_blink_interval 0 # 禁用闪烁
shell_integration no-cursor

进阶技巧

远程控制 API

启用远程控制后,可通过 kitty @ 命令控制 Kitty。

1
2
allow_remote_control yes
listen_on unix:/tmp/kitty

常用命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 列出所有窗口
kitty @ ls

# 发送文本到窗口
kitty @ send-text --match title:vim "iHello\x1b"

# 设置窗口标题
kitty @ set-window-title "My Window"

# 创建新窗口
kitty @ launch --type=tab --title="Build" npm run build

# 关闭窗口
kitty @ close-window --match title:temp

# 修改配置
kitty @ set-colors --all background=#000000

条件配置

根据操作系统或其他条件应用配置:

1
2
3
4
5
# 包含特定平台配置
include ${HOME}/.config/kitty/macos.conf

# 或使用环境变量
include ${KITTY_OS}.conf

macos.conf:

1
2
font_size 16.0
macos_titlebar_color dark

linux.conf:

1
2
font_size 14.0
linux_display_server wayland

会话管理

启动会话配置 (~/.config/kitty/sessions/dev.conf):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 开发环境会话
new_tab Development
cd ~/projects/myapp
launch zsh

new_tab Server
cd ~/projects/myapp
launch npm run dev

new_tab Database
launch psql mydb

# 激活第一个标签页
focus
goto_tab 1

启动会话:

1
kitty --session ~/.config/kitty/sessions/dev.conf

或在配置中:

1
startup_session ~/.config/kitty/sessions/dev.conf

与 tmux 对比

功能 Kitty tmux
性能 GPU 加速,极快 CPU 渲染
图像显示 原生支持 需要额外工具
分屏 内置布局系统 完整的窗格管理
会话持久化 不支持 支持 detach/attach
远程使用 SSH kitten 完美支持
可编程性 Python API Shell 脚本

何时使用 tmux:

  • 需要会话持久化
  • 经常在远程服务器工作
  • 需要在多台机器共享会话

何时使用 Kitty:

  • 本地开发为主
  • 需要显示图像/图表
  • 追求极致性能

工作流示例

前端开发工作流:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# ~/.config/kitty/sessions/frontend.conf
new_tab Editor
cd ~/projects/webapp
launch nvim

new_tab Server
cd ~/projects/webapp
launch npm run dev

new_tab Terminal
cd ~/projects/webapp
launch zsh

new_tab Logs
cd ~/projects/webapp
launch tail -f logs/app.log

layout tall
focus
goto_tab 1

数据科学工作流:

1
2
3
4
5
# 使用 icat 显示图像
kitty +kitten icat plot.png

# Jupyter notebook 集成
kitty @ launch jupyter notebook

键盘宏

创建复杂的组合动作:

1
2
3
4
5
# 组合多个动作
map f1 combine : new_window : send_text "ls -la\n"

# 条件执行
map f2 combine : new_tab : set_tab_title "Build" : send_text "npm run build\n"

主题切换快捷键

1
2
3
4
# 快速切换主题
map kitty_mod+t>1 set_colors --configured ~/.config/kitty/themes/tokyo-night.conf
map kitty_mod+t>2 set_colors --configured ~/.config/kitty/themes/gruvbox.conf
map kitty_mod+t>3 set_colors --configured ~/.config/kitty/themes/dracula.conf

环境变量管理

1
2
3
4
5
6
7
# 设置开发环境变量
env NODE_ENV=development
env EDITOR=nvim
env VISUAL=nvim

# 修改 PATH
env PATH=${HOME}/.local/bin:${HOME}/bin:${PATH}

自动化脚本

备份配置:

1
2
3
#!/bin/bash
# ~/.config/kitty/backup.sh
tar -czf ~/kitty-config-$(date +%Y%m%d).tar.gz ~/.config/kitty/

批量操作窗口:

1
2
3
4
5
#!/bin/bash
# 在所有窗口中运行命令
for window in $(kitty @ ls | jq '.[].tabs[].windows[].id'); do
kitty @ send-text --match id:$window "git pull\n"
done

完整配置示例

基础配置

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
# ═══════════════════════════════════════
# Kitty 基础配置示例
# ═══════════════════════════════════════

# 字体
font_family JetBrains Mono
bold_font JetBrains Mono Bold
italic_font JetBrains Mono Italic
bold_italic_font JetBrains Mono Bold Italic
font_size 14.0
disable_ligatures cursor

# 光标
cursor_shape beam
cursor_blink_interval 0.5
cursor_stop_blinking_after 15.0

# 滚动
scrollback_lines 10000
wheel_scroll_multiplier 5.0

# 鼠标
mouse_hide_wait 3.0
url_style curly
open_url_with default
copy_on_select no

# 性能
repaint_delay 10
input_delay 3
sync_to_monitor yes

# 窗口
window_padding_width 4
window_margin_width 0
window_border_width 1pt
enabled_layouts tall,fat,grid,splits,stack
remember_window_size yes
initial_window_width 1200
initial_window_height 800

# 标签页
tab_bar_style powerline
tab_bar_align left
tab_title_template "{index}: {title}"

# Shell 集成
shell_integration enabled

# 高级
allow_remote_control yes
listen_on unix:/tmp/kitty
clipboard_control write-clipboard write-primary read-clipboard-ask read-primary-ask

Tokyo Night 主题配置

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
# ═══════════════════════════════════════
# Tokyo Night 主题
# ═══════════════════════════════════════

foreground #a9b1d6
background #1a1b26
selection_foreground #1a1b26
selection_background #a9b1d6
cursor #a9b1d6
cursor_text_color #1a1b26

# 标签页颜色
active_tab_foreground #1a1b26
active_tab_background #7aa2f7
inactive_tab_foreground #a9b1d6
inactive_tab_background #292e42

# 窗口边框
active_border_color #7aa2f7
inactive_border_color #292e42

# 16 色
color0 #15161e
color1 #f7768e
color2 #9ece6a
color3 #e0af68
color4 #7aa2f7
color5 #bb9af7
color6 #7dcfff
color7 #a9b1d6
color8 #414868
color9 #f7768e
color10 #9ece6a
color11 #e0af68
color12 #7aa2f7
color13 #bb9af7
color14 #7dcfff
color15 #c0caf5

# 透明度
background_opacity 0.95
dynamic_background_opacity yes

完整键盘映射

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
# ═══════════════════════════════════════
# 键盘映射
# ═══════════════════════════════════════

kitty_mod ctrl+shift

# 复制粘贴
map kitty_mod+c copy_to_clipboard
map kitty_mod+v paste_from_clipboard
map kitty_mod+s paste_from_selection
map kitty_mod+o pass_selection_to_program

# 窗口管理
map kitty_mod+enter new_window
map kitty_mod+n new_os_window
map kitty_mod+w close_window
map kitty_mod+] next_window
map kitty_mod+[ previous_window
map kitty_mod+f move_window_forward
map kitty_mod+b move_window_backward
map kitty_mod+` move_window_to_top
map kitty_mod+r start_resizing_window

# 标签页管理
map kitty_mod+t new_tab
map kitty_mod+q close_tab
map kitty_mod+right next_tab
map kitty_mod+left previous_tab
map kitty_mod+. move_tab_forward
map kitty_mod+, move_tab_backward
map kitty_mod+alt+t set_tab_title

# 布局
map kitty_mod+l next_layout
map kitty_mod+shift+l last_used_layout

# 字体
map kitty_mod+equal change_font_size all +2.0
map kitty_mod+plus change_font_size all +2.0
map kitty_mod+minus change_font_size all -2.0
map kitty_mod+0 change_font_size all 0

# 搜索
map kitty_mod+f show_scrollback

# 配置
map kitty_mod+f5 load_config_file
map kitty_mod+f2 edit_config_file
map kitty_mod+f11 toggle_fullscreen

# Kittens
map kitty_mod+u kitten unicode_input
map kitty_mod+p>f kitten hints --type path --program -
map kitty_mod+p>h kitten hints --type hash --program -
map kitty_mod+p>l kitten hints --type line --program -
map kitty_mod+p>w kitten hints --type word --program -

# Shell 集成
map kitty_mod+z scroll_to_prompt -1
map kitty_mod+x scroll_to_prompt 1

# 其他
map kitty_mod+escape kitty_shell window
map kitty_mod+delete clear_terminal reset active

开发者配置

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
# ═══════════════════════════════════════
# 开发者优化配置
# ═══════════════════════════════════════

# 环境变量
env EDITOR=nvim
env VISUAL=nvim
env TERM=xterm-kitty

# 启动会话
startup_session ~/.config/kitty/sessions/dev.conf

# 性能优化
repaint_delay 5
input_delay 1
sync_to_monitor yes
scrollback_lines 50000

# 远程控制
allow_remote_control yes
listen_on unix:/tmp/kitty

# 更新
update_check_interval 0

# 确认关闭
confirm_os_window_close 0

参考资源

官方资源

主题资源

社区

相关工具

  • tmux: 会话管理器,可与 Kitty 配合使用
  • zsh/fish: 推荐的现代 Shell
  • starship: 跨 Shell 的提示符工具
  • fzf: 模糊查找工具,与 Kitty 集成良好

版本说明

  • 文档版本: 2.0
  • 基于 Kitty: 0.32.x - 0.35.x
  • 最后更新: 2026-02-04
  • 维护状态: 持续更新中

快速命令参考卡

窗口操作

1
2
3
4
5
Ctrl+Shift+Enter    新建窗口
Ctrl+Shift+W 关闭窗口
Ctrl+Shift+] 下一个窗口
Ctrl+Shift+[ 上一个窗口
Ctrl+Shift+R 调整窗口大小

标签页操作

1
2
3
4
5
Ctrl+Shift+T        新建标签页
Ctrl+Shift+Q 关闭标签页
Ctrl+Shift+→ 下一个标签页
Ctrl+Shift+← 上一个标签页
Ctrl+Shift+Alt+T 设置标签页标题

常用功能

1
2
3
4
5
6
7
Ctrl+Shift+C        复制
Ctrl+Shift+V 粘贴
Ctrl+Shift+F 搜索
Ctrl+Shift+F5 重载配置
Ctrl+Shift+F2 编辑配置
Ctrl+Shift+L 切换布局
Ctrl+Shift+F11 全屏

Kittens

1
2
3
4
Ctrl+Shift+U        Unicode 输入
Ctrl+Shift+P,F 路径提示
kitty +kitten icat 显示图片
kitty +kitten ssh SSH 连接

🎉 现在你已经掌握了 Kitty 终端的全部功能!祝你使用愉快!