kitty is a fast terminal emulator for Linux and macOS. It includes many features, but the one that interested me was support for ligatures in code. Ligatures basically let you combine symbols, characters, or graphemes to produce a single glyph with compressed meaning.
via Github
Confused yet? Me too. I barely understand what I’m trying to describe here. Really it’s just that ligatures make your code look cooler than the plain text most developers enter and read for hours a day. Whether they improve life in any meaningful fashion is arguable, but “it looks cooler” is good enough for me today.
By using a special font such as Fira Code and a capable terminal, all sorts of character transformations happen. For example, the <
and =
characters combined as ⇐
— to indicate “less than or equal to” — displays as ⩽
. It means the same thing, but it says it with a single visual character.
We have this rich library of symbols to describe our solutions, but most programming languages use a tiny subset of those symbols. Except Raku of course. Raku sort of does everything.
Anyways, back to ligatures. They let you pretend you’re using that rich library of symbols.
Gnome Terminal does not support ligatures, at least not on my system. Konsole from the KDE project does, but adds many KDE-specific dependencies to my system. I wanted to find something a bit more lightweight.
kitty satisfies that need.
Installing kitty
kitty runs on both Linux and macOS, but right now I’m concerned with Linux. I already have iTerm2 for ligatures on macOS.
The installation instructions for kitty follow a familiar pattern of “grab and run the installer script.” If you don’t feel safe with that you can install from source.
installer.sh
loads Python to download the latest kitty
executable to ~/.local/kitty.app
on Linux.
I followed the installation instructions for desktop integration, making small adjustments as needed for my own system setup.
These steps put kitty on my $PATH
and create a desktop entry complete with application icon for launching from the GNOME Menu.
My desktop entry file ended up looking like this after a couple edits (specifying executable path, stuff like that).
Course, I still had to tell GNOME the desktop launcher was trustworthy but opening ~/.local/share/applications/kitty.desktop
in the GNOME file manager.
Font installation
I need a font that supports ligatures now. Fira Code is the one I know best, though I wouldn’t mind trying others. Fortunately, Fira Code is available via my system package manager.
kitty configuration
Next step is to define my configuration in ~/.config/kitty/kitty.conf
. The whole point of this experiment is to get ligatures, so that’s my first configuration change.
Then throw in some window geometry stuff. Normally kitty remembers and applies the last window size you used, but I often don’t want that for the quick transient terminals I open during my day. Instead I go with a terminal 110 characters wide and 40 columns tall.
kitty does not load a login shell by default. I prefer a login shell, so I specify that in kitty.conf
.
Using kitty
The ligatures are pretty, of course. But what I really notice? Kitty is fast. Maybe that’s just because I became accustomed to GNOME Terminal and its sluggishness. Kitty might not be rxvt fast, but it’s much quicker than what I’m used to.
Since kitty is a terminal emulator, most of the functionality is familiar. The default keyboard shortcuts are similar to those offered by GNOME Terminal, with support for clipboard access and tabs. kitty also supports windows much like panes in tmux, but for now I’m sticking with the familiarity of tmux.
Speaking of tmux
terminfo should install what’s needed, but if not you will see an annoying message when you try to start tmux:
This works:
But see this StackExchange item for better instructions. Or at least a pointer to better instructions.
kittens
Kittens are Python scripts that take advantage of features provided by kitty. Kitty includes built-in kittens for handling handling arbitrary text such as URLs, working with the clipboard, and viewing file diffs. You can even write your own!
Most of the kittens are useful, but a couple also make for great screenshots. So here they are 😸
icat
icat shows an image in the terminal.
Over on Twitter, Yanick Champoux noted that
icat
does not play well with tmux.
{{< tweet user=“yenzie” id=“1133131184089681920” >}}
Confirmed for myself by running icat in a tmux window.
Dang. Thanks, Yanick!
Unicode Input
Control-Shift-U
lets you enter Unicode characters, by code or by name.
kitty is fun
Even if I get tired of ligatures — a distinct possibility — I can see continuing to use kitty for its speed and extensibility. Anyways, it’s fun to expand my toolkit a little more!
Backlinks
Got a comment? A question? More of a comment than a question?
Talk to me about this page on: mastodon
Added to vault 2024-01-15. Updated on 2024-02-01