kitty

From ArchWiki

kitty is a scriptable OpenGL based terminal emulator with TrueColor, ligatures support, protocol extensions for keyboard input and image rendering. It also offers tiling capabilities, like GNU Screen or tmux.

Installation

Install the kitty package or kitty-gitAUR for the development version.

Usage

New tabs and windows can be created and resized through various Ctrl+Shift shortcuts. Layouts are switchable through Ctrl+Shift+l and can be saved/restored.

A full keyboard mode provides distinction between ambiguous keys like Ctrl+i vs Tab. Moreover, new text effects like curly-underline are also available for applications that support it.

Kittens

kitty has a framework for creating subprograms called kittens. The commands for all kittens are prefixed with kitty +kitten, so it is convenient to use them as shell aliases.

icat

This kitten is based on the kitty graphics protocol. It needs ImageMagick to be installed. To show an image in the terminal:

$ kitty +kitten icat image.jpg

It can also display animated gifs in the terminal. Instead of an image file, you can pass a directory or an image url. This also works over ssh to display images from a remote server. Several applications such as ranger and neofetch use this protocol for displaying images in the terminal. For more information, see the official documentation

diff

This kitten requires either git or diffutils to be installed. Optionally, install python-pygments for syntax highlighting. To show a diff of two files:

$ kitty +kitten diff file1 file2

It displays diffs for images as well as text files. This kitten can also be used over ssh. You can pass directories instead of files for a recursive diff. For more information, see the official documentation.

clipboard

This kitten is used to read and write to the system clipboard and can be used to work with a clipboard even over ssh. To copy stdin to the system clipboard:

$ echo "Hello" | kitty +kitten clipboard

To output the current clipboard contents to stdout:

$ kitty +kitten clipboard --get-clipboard

This command will show a permission popup by default. To disable this, edit the clipboard_control option in the configuration file:

~/.config/kitty/kitty.conf
clipboard_control write-clipboard read-clipboard

For more information, see the official documentation.

Configuration

kitty stores its configuration in ~/.config/kitty/kitty.conf and the default configuration can be found at /usr/share/doc/kitty/kitty.conf. Fonts, colors, cursors and scrollback behaviors can be adjusted. You can see all available options in the official documentation or kitty.conf(5).

Note: If you are editing the default configuration with vim, the sections will begin folded. Each section can be expanded by using zo in normal mode.
Tip:
  • The default configuration file at /usr/share/doc/kitty/kitty.conf is self-documenting with comments explaining each option.
  • The official documentation is available locally at /usr/share/doc/kitty/html/index.html.

Tips and Tricks

Enable IME support

Kitty support for IBus IME framework is disabled by default. To enable it, set the environment variable GLFW_IM_MODULE=ibus. This will also work with Fcitx5 due to the compatible IBus interface that it offers.

Single instance mode

This works similar to a daemon mode. When kitty is launched with the --single-instance or -1 option, only one instance of kitty will run. Launching kitty subsequently with the same option will create a new window of the existing kitty instance. This will lower memory usage because of a shared GPU cache and also reduces startup time. You can have multiple groups of kitty instances with --instance group name option. See kitty(1) § single for more information.

Troubleshooting

Terminal issues with SSH

When kitty is used to ssh into a remote that does not have its terminfo, various issues can occur. The solution is normally to copy over the terminfo. Kitty has an ssh kitten to automate exactly this.

$ kitty +kitten ssh user@host

You may want to set it as an alias for ssh. One way to do that is to detect if the user is using Kitty, and if so, alias the ssh command. To do that, you would append the following line to your ~/.bashrc or ~/.zshrc file:

[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh"

If for whatever reason you are unable to install the terminfo on the remote, you can try setting TERM to something that is more likely to be present. Note that this might disable some of the terminal's features. See OpenSSH#Connecting to a remote without the appropriate terminfo entry.

Disappearing background color in vim

When using a color scheme with a background color in vim, the background may disappear or flicker while scrolling. To fix this, make sure the environment variable TERM is still set to xterm-kitty, then add this line to your .vimrc file:

~/.vimrc
let &t_ut=''

Related bug reports: Github issue #108, kitty FAQ

See also