我已经使用 Kitty 几天了。我使用它是因为有一个 nvim 的插件可以与 kitty 无缝切换焦点,所以我不需要重复设置,我非常喜欢它。
经过一段时间的使用,我完成了部分配置,现在我想分享它。
我为相关功能使用不同的文件夹。比如主题、标签、窗口和快捷键。
# lxz @ lxzMacBook-Pro in ~/.dot/kitty/.config/kitty on git:master o [16:38:58]
$ tree
.
├── kitty.conf
├── kitty.d
│ ├── init
│ │ └── init.conf
│ ├── keybind
│ │ ├── init.conf
│ │ ├── nvim.conf
│ │ ├── tab.conf
│ │ └── window.conf
│ ├── session
│ │ └── init.conf
│ └── theme
│ ├── background.conf
│ ├── color.conf
│ ├── font.conf
│ ├── tabbar.conf
│ └── window.conf
└── session.conf
6 directories, 13 files
基本设置#
在 kitty.conf 中,我只是设置加载其他目录中的配置文件。
globinclude kitty.d/**/*.conf
我不会展示拆分后的配置,只会根据功能给出提示。
初始化#
在 init.conf 中,我设置了一些默认变量。
term xterm-256color
shell_integration enabled
allow_hyperlinks yes
editor nvim
主题设置#
标签设置#
在标签设置中,我喜欢 powerline
风格。
tab_bar_style powerline
窗口设置#
window_border_width 0.5pt
window_resize_step_cells 2
window_resize_step_lines 2
initial_window_width 640
initial_window_height 400
draw_minimal_borders yes
inactive_text_alpha 0.7
hide_window_decorations no
macos_titlebar_color background
macos_thicken_font 0.75
active_border_color none
# 默认布局仅为垂直分割
enabled_layouts splits
enable_audio_bell no
字体设置#
font_family FiraCode Nerd Font Mono Retina
font_size 16.0
颜色设置#
# Dark One Nuanced by ariasuni, https://store.kde.org/p/1225908
# Imported from KDE .colorscheme format by thematdev, https://thematdev.org
# For migrating your schemes from Konsole format see
# https://git.thematdev.org/thematdev/konsole-scheme-migration
# importing Background
background #282c34
# importing BackgroundFaint
# importing BackgroundIntense
# importing Color0
color0 #3f4451
# importing Color0Faint
color16 #282c34
# importing Color0Intense
color8 #4f5666
# importing Color1
color1 #e06c75
# importing Color1Faint
color17 #c25d66
# importing Color1Intense
color9 #ff7b86
# importing Color2
color2 #98c379
# importing Color2Faint
color18 #82a566
# importing Color2Intense
color10 #b1e18b
# importing Color3
color3 #d19a66
# importing Color3Faint
color19 #b38257
# importing Color3Intense
color11 #efb074
# importing Color4
color4 #61afef
# importing Color4Faint
color20 #5499d1
# importing Color4Intense
color12 #67cdff
# importing Color5
color5 #c678dd
# importing Color5Faint
color21 #a966bd
# importing Color5Intense
color13 #e48bff
# importing Color6
color6 #56b6c2
# importing Color6Faint
color22 #44919a
# importing Color6Intense
color14 #63d4e0
# importing Color7
color7 #e6e6e6
# importing Color7Faint
color23 #c8c8c8
# importing Color7Intense
color15 #ffffff
# importing Foreground
foreground #abb2bf
# importing ForegroundFaint
# importing ForegroundIntense
# importing General
快捷键设置#
初始化#
# 清除终端屏幕
map cmd+k combine : clear_terminal scrollback active : send_text normal,application \x0c
# 跳到单词的开头和结尾
map alt+left send_text all \x1b\x62
map alt+right send_text all \x1b\x66
# 跳到行的开头和结尾
map cmd+left send_text all \x01
map cmd+right send_text all \x05
# 将 cmd + <num> 映射到对应的标签
map cmd+1 goto_tab 1
map cmd+2 goto_tab 2
map cmd+3 goto_tab 3
map cmd+4 goto_tab 4
map cmd+5 goto_tab 5
map cmd+6 goto_tab 6
map cmd+7 goto_tab 7
map cmd+8 goto_tab 8
map cmd+9 goto_tab 9
# 改变字体大小
map cmd+equal change_font_size all +2.0
map cmd+minus change_font_size all -2.0
map cmd+0 change_font_size all 0
map cmd+c copy_to_clipboard
map cmd+v paste_from_clipboard
标签#
map alt+1 goto_tab 1
map alt+2 goto_tab 2
map alt+3 goto_tab 3
map alt+4 goto_tab 4
map alt+5 goto_tab 5
map alt+6 goto_tab 6
map alt+7 goto_tab 7
map alt+8 goto_tab 8
map alt+9 goto_tab 9
map alt+0 goto_tab 0
# 用 cmd+t 打开新标签
map cmd+t new_tab
# 在下一个和上一个分割之间切换
map cmd+] next_window
map cmd+[ previous_window
窗口#
# 用 cmd+d 打开新分割(窗口),保留当前工作目录
map cmd+w close_window
map cmd+shif+n new_os_window
map cmd+d launch --location=hsplit --cwd=current
map cmd+shift+d launch --location=vsplit --cwd=current
会话#
Kitty 支持会话管理,我添加了一些默认会话,并为 nvim 打开了会话套接字。
根目录下的 session.conf 是会话的位置信息配置。
new_tab home
layout splits
cd ~
launch zsh
focus
new_tab work
cd ~/Develop/linuxdeepin/
launch zsh
new_tab nvim
cd ~/.config/nvim
launch zsh
初始化#
startup_session session.conf
# 其他 Unix 系统:
allow_remote_control yes
listen_on unix:/tmp/.kitty