终端的配置 (kitty, zsh)

本文介绍: 我的 kitty 和 zsh 是如何配置的

同时: 简单介绍一下 kitty 该怎样配置 (来自 kitty 官网的文档)

kitty 配置

kitty 的配置文件在 ~/.config/kitty/kitty.conf

下文称 ~/.config/kitty 为 kitty 的根目录

kitty.conf 的语法是: 名字 值 意味着这个名字的配置选项的值为给定的值. 中间就用空格分开, 不需要等于号之类的东西

并且可以 include: include xxx.conf 就可以把 xxx.conf 中的内容加入进来

因此, 我的配置文件分为: kitty.conf 中少量配置, my/appr.conf 配置外观, my/key.conf 配置按键

首先, kitty.conf 中, 加入: allow_remote_control yes

这启用了 kitty 的 remote control. 它大概是 kitty @ xxx-xxx 的形式, xxx-xxx 是 kitty 内部的命令, 比如 kitty @ load-config 重新加载配置, 这很有用. 此外 ctrl+shift+F5 快捷键也可以重新加载配置. 其它还有 set-tab-title 设置标签页标题, 还有 set-tab-color, set-font-size, ...

然后, appr.conf 中:

1
2
3
4
5
6
7
8
9
10
11
background_opacity 0.9
# 设置透明度

font_family FiraCode Nerd Font Mono
bold_font auto
font_size 20.0
# 设置字体

tab_bar_style powerline
tab_bar_edge top
# 设置 tab bar 的外观与位置

key.conf 中:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
map ctrl+shift+tab previous_tab
map ctrl+tab next_tab

map ctrl+shift+t launch --type=tab --cwd=~ --tab-title=~
map ctrl+shift+k launch --type=tab --cwd=current --tab-title=current
# ctrl+shift+k:复制一个一样的

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

我设置的这些标签页相关的键位, 是和浏览器一致的. 一致的键位总让人舒服.

标签管理:自己写的小应用

我写了一个叫做 kitab 的终端应用,用来管理 kitty 终端

具体功能有:

1
2
3
4
5
6
7
8
kitab: 
kitab [no args]: = ctrl+shift+t, new ~ tab
kitab [preset]: open preset : ~/kitty-tab/$preset.sh
kitab [name]: new tab, title=$name (if $name is not a preset)
kitab -h: (--help) show help
kitab -r [name]: (--rename) set-tab-title $name
kitab -d [path]: (--dump) dump status to $path, default: ~/kitty-tab/t.json
kitab -l [path]: (--load) load status from $path, default: ~/kitty-tab/t.json

里面就是简单的 C++ 代码,调用 kitty @ launch ... 之类的东西

不过用起来非常舒服!毕竟 kitty @ ... 还是很长的,kitab -xxx 则短的多

zsh 的配置

我的Linux配置