

Kitty: 又一款基于 GPU 加速的终端工具
source link: https://www.51cto.com/article/710018.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.


基于 GPU 的功能强大的终端仿真器(跨平台是王道)
近几年越来越多人喜欢使用 dotfiles
中进行追踪自己的服务端相关的工具配置,这样就可以跨平台使用,只需要同步一下配置,即可无痛使用机器了。
Kitty
是一个跨平台、特性丰富的基于 GPU
的终端模拟器。使用线程渲染将输入延迟最小化,以及 GPU
渲染技术,使得肉眼可见的速度提升,以及降低系统负载和平滑的滚动效果。它是一个轻量级的模拟器,可以通过脚本、shell
提示符和 SSH
进行控制。
- Kitty - 官方仓库
- Kitty - 官方文档
- Kitty - 官方文档 - 快捷键
- Kitty - 官方文档 - 集成功能
1. 终端安装
简单介绍终端的安装以及相关的配置文件
如果你系统安装(带图形化界面)之后,默认的终端是 Gnome Terminal
这个,如果我们直接使用的话,比如分屏显示、同时执行命令等高级操作多需要借助于第三方插件来完成,比如使用功能 Tmux
等。而 kitty
是一个功能完备的终端,其包含的功能做了Tmux
所做的一切,且做的更好。
- 跨平台 (
Linux/macOS
) - 纯文本的配置 (
config
) - 肉眼可见的速度提升 (
GPU
)
# 二进制安装
# Linux: ~/.local/kitty.app
# macOS: /Applications/kitty.app
$ curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh
# Ubuntu安装
$ sudo apt update
$ sudo apt install kitty -y
$ kitty
# 任务栏显示
$ ln -s ~/.local/kitty.app/bin/kitty ~/.local/bin/
$ cp ~/.local/kitty.app/share/applications/kitty.desktop ~/.local/share/applications/
$ cp ~/.local/kitty.app/share/applications/kitty-open.desktop ~/.local/share/applications/
$ sed -i "s|Icon=kitty|Icon=/home/$USER/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" ~/.local/share/applications/kitty*.desktop
# 默认的配置文件
# 默认不支持热加载配置(需重进)
~/.config/kitty/kitty.conf
# 调试模式
$ kitty --debug-config
2. 使用方式
介绍如何快速使用该终端和其对应快捷键组合!
- [1] Scrolling

Kitty 基于 GPU 的终端工具 - Scrolling
- [2] Tabs

Kitty 基于 GPU 的终端工具 - Tabs
- [3] Windows
Kitty 基于 GPU 的终端工具 - Scrolling
- [4] Other

Kitty 基于 GPU 的终端工具 - Scrolling
3. 开箱即用
Kitty 的核心部分采用 C 编写, UI 界面采用 python 展示!
Kitty
提供了极其强大的接口,如脚本控制、自定义 kittens
和 icat
看图功能,允许它无缝地与其他工具集成。
- 查看更多的 Kitty 扩展功能

Kitty 基于 GPU 的终端工具 - 开箱即用
- 显示的色彩效果是真的好
- [1] diff
# 对比
$ kitty +kitten diff file1 file2
# 集成到git配置里面
$ vim ~/.gitconfig
[diff]
tool = kitty
guitool = kitty.gui
[difftool]
prompt = false
trustExitCode = true
[difftool "kitty"]
cmd = kitty +kitten diff $LOCAL $REMOTE
[difftool "kitty.gui"]
cmd = kitty kitty +kitten diff $LOCAL $REMOTE

Kitty 基于 GPU 的终端工具 - diff
- 可以直接终端里面显示图片
- [2] icat
# 图片
$ kitty +kitten icat
# 设置别名
$ vim ~/.zshrc
alias icat="kitty +kitten icat"

Kitty 基于 GPU 的终端工具 - icat
- 可以让你即时预览主题效果并支持一键切换
- [3] themes
# 主题
$ kitty +kitten themes
$ kitty +kitten themes --reload-in=all Dimmed Monokai

Kitty 基于 GPU 的终端工具 - themes
- 接受字符然后输出对应码
- [4] Unicode input
# 输出
$ kitty +kitten unicode_input
- 将终端所以的链接地址高亮起来并可以快捷打开
- [5] Hints
# 设置快捷键绑定
$ map ctrl+g kitten hints \
--type=linenum \
--linenum-action=tab nvim +{line} {path}

Kitty 基于 GPU 的终端工具 - Hints
4. 缺点介绍
介绍该终端工具目前还没有实现的特性!
tmux-plugins/tmux-resurrect
自动保存tmux-plugins/tmux-continuum
自动加载
- [1] 会话保存和加载
# kitty目前还没有直接就拿来能用的插件方案
# https://github.com/kovidgoyal/kitty/issues/1197)
- 并没有像
tmux
一样自带这个功能 - 但是其扩展能力极强,实现这个 非常轻松
- [2] 禅模式
# vim ~/.config/kitty/zoom_toggle.py
def main(args):
pass
from kittens.tui.handler import result_handler
@result_handler(no_ui=True)
def handle_result(args, answer, target_window_id, boss):
tab = boss.active_tab
if tab is not None:
if tab.current_layout.name == 'stack':
tab.last_used_layout()
else:
tab.goto_layout('stack')
- 有
panel
貌似可以实现类似的功能
- [3] 状态栏
# 可以实现类似的功能
# https://sw.kovidgoyal.net/kitty/kittens/panel/
- 如果尝试
ssh
到远程机器,可能会发生报错
- [4] 远程机器
# 不能使用远程SSH命令
# https://sw.kovidgoyal.net/kitty/faq
$ kitty +kitten ssh myserver
# 设置别名
$ vim ~/.zshrc
alias ssh="kitty +kitten ssh"
5. 参考链接
- Kitty – 一个被严重忽视的生产力利器
Recommend
-
69
reddit: the front page of the internet
-
57
-
49
README.md Welcome to the KiTTY introduction web site What is KiTTY ? KiTTY is a fork from version 0.71 of PuTTY, the best tel...
-
12
Kitty Letter word-scrambled my brain Kitty Letter is a free mobile game from the creator of The Oatmeal webcomic. It’s a simple word game...
-
7
Google adds Pac-Man, Hello Kitty, Gundam mechs, and more to AR search Celebrating Japanese anime, video games, and TV By...
-
10
April 24th, 2021 · ~4 minutes My coworker Anita Singh and I have been working on some Slack guidelines for Gorillas in order to encourage mindful...
-
6
A protocol for comprehensive keyboard handling in terminals¶ There are various problems with the current...
-
9
...
-
9
Blender 3.0 将支持基于 AMD HIP 的 GPU 加速 ...
-
5
又一款眼前一亮的Linux终端工具!-51CTO.COM 又一款眼前一亮的Linux终端工具! 作者:良许 2022-07-28 15:46:08 今天给大家介绍一款最近发现的功能十分强大,颜值非常高的一款终端...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK