1041 Words

📦 This page comes from my GitHub repository kitty_terminal_working_config_example and is updated automatically when I change it there.

🐱 Kitty Terminal: My Working Config

kitty is a fast, GPU-accelerated terminal for Linux and macOS. I switched to it from GNOME Terminal + Zellij, because kitty does everything I used a multiplexer for (tabs, splits, layouts) and a lot more: it shows images, makes file names clickable, and has small built-in tools called kittens.

This repository is the configuration I use every day, together with Oh My Zsh. Use it as a starting point and change whatever you like.


📦 What’s in this repository

FileWhat it does
kitty.confThe main configuration: font, layouts, tab bar, hyperlinks, SSH fixes
current-theme.confThe colours: a dark aubergine theme (Ubuntu-style)
tab_bar.pyA custom tab bar with a live clock on the right
open-actions.confWhat happens when you click a file: .log files open in tail -f, images open in the terminal
cheatsheet.mdAll the keyboard shortcuts on one page

🚀 Installation

1. Install kitty

Use the official installer; it always gives you the latest version:

curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin

The installer puts kitty in ~/.local/kitty.app. Make it available in your shell and in your desktop menu (official instructions):

mkdir -p ~/.local/bin ~/.local/share/applications
ln -sf ~/.local/kitty.app/bin/kitty ~/.local/kitty.app/bin/kitten ~/.local/bin/
cp ~/.local/kitty.app/share/applications/kitty*.desktop ~/.local/share/applications/
sed -i "s|Icon=kitty|Icon=$(readlink -f ~)/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" ~/.local/share/applications/kitty*.desktop
sed -i "s|Exec=kitty|Exec=$(readlink -f ~)/.local/kitty.app/bin/kitty|g" ~/.local/share/applications/kitty*.desktop

2. Install the font

The config uses FiraCode Nerd Font Mono: Fira Code with programming ligatures, plus the icons that many Zsh themes use. Download it from nerdfonts.com and install it in your user font folder:

mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts
curl -LO https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.zip
unzip -o FiraCode.zip && rm FiraCode.zip
fc-cache -f

💡 Only want the plain Fira Code font? Install fonts-firacode (Debian/Ubuntu) or fira-code-fonts (Fedora) and set font_family Fira Code in kitty.conf.

You can check which fonts kitty sees with kitten choose-fonts.

3. Get this configuration

Clone this repository into kitty’s configuration folder. Back up your current config first if you have one:

[ -d ~/.config/kitty ] && mv ~/.config/kitty ~/.config/kitty.backup
git clone https://github.com/Benjamin-Italiaander/kitty_terminal_working_config_example.git ~/.config/kitty

Restart kitty, or press ctrl+shift+F5 to reload the config.


⌨️ The modifier key

All kitty shortcuts start with the kitty modifier, written as mod in the cheatsheet. In this config it is the default, Ctrl+Shift:

kitty_mod ctrl+shift

On the MATE desktop some Ctrl+Shift shortcuts clash with the desktop’s own shortcuts. In that case use Ctrl+Super instead:

# kitty_mod ctrl+shift
kitty_mod ctrl+super

✨ Highlights of this config

A tab bar with a clock

tab_bar_style custom loads tab_bar.py. It draws the tabs at the bottom of the window and a clock on the right that updates every second. Every tab title starts with a 😸, and a tab that rings the bell gets a 🔔.

With show_hyperlink_targets yes and underline_hyperlinks hover, links are underlined when you hover over them and kitty shows where they point. Make ls print clickable file names:

alias ls='ls --hyperlink=auto --color=auto'

What happens when you click a file is set in open-actions.conf:

  • a .log file opens in a new window with tail -f, in a slightly smaller font;
  • an image opens full-size inside the terminal.

Copy on select

copy_on_select yes copies text to the clipboard as soon as you select it, just like on most Linux desktops.

SSH that just works

Two settings fix the most common problems on old servers and network switches:

term xterm-256color              # some remote systems don't know "xterm-kitty"
map backspace send_text all \x7f # Backspace works on switches and routers

Even better is kitty’s own SSH kitten (kitten ssh host). It copies kitty’s terminal settings to the server for you, so vim, htop and colours work, and it sets up shell integration on the remote side.

Layouts

enabled_layouts Tall, * starts with the Tall layout (one big window on the left, the others stacked on the right). Press mod + L to cycle through the other layouts, such as Grid, Fat and Stack.

The kitty shell

mod + Esc opens the kitty shell, where you can control kitty with commands, for example launch --type=tab or set-font-size 16. Because allow_remote_control yes is on, scripts can do the same with kitten @.


🧰 Handy aliases

Kitty sets the variable KITTY_WINDOW_ID in every window it opens. Use it to add aliases that only apply inside kitty, so other terminals keep working as before. Put this after your normal aliases in ~/.zshrc or ~/.bashrc:

if [ -n "$KITTY_WINDOW_ID" ]; then
    alias ssh="kitten ssh"                 # SSH with kitty's terminal settings
    alias ls="ls --hyperlink=auto --color=auto"
    alias icat="kitten icat"               # show an image in the terminal
    alias kopen="kitty +open"              # open a file as set in open-actions.conf
    alias kdiff="kitten diff"              # side-by-side diff of two files or folders
    alias kthemes="kitten themes"          # pick a colour theme
    alias clip="kitten clipboard"          # copy stdin to the clipboard
    alias paste="kitten clipboard --get-clipboard"
    alias vim="vim -c 'set termguicolors'"
fi

Reload your shell with source ~/.zshrc (or ~/.bashrc), then try:

icat photo.png                 # an image, right in your terminal
kdiff old.conf new.conf        # a colourful side-by-side diff
ip -c addr | clip              # copy command output to the clipboard
kopen server.log               # opens in tail -f, thanks to open-actions.conf

💡 Older kitty versions used kitty +kitten icat instead of kitten icat. Both still work.


🐱 Cheatsheet: the shortcuts I use most

mod is the kitty modifier (Ctrl+Shift in this config). The full list is in cheatsheet.md.

ShortcutWhat it does
mod + EnterNew window (split) in the current tab
mod + TNew tab
mod + ← / →Previous / next tab
mod + [ / ]Previous / next window
mod + LNext layout
mod + RResize the current window
mod + F7Show window numbers and jump to one
mod + GShow the output of the last command
mod + HBrowse the scrollback in a pager
mod + Z / XJump to the previous / next shell prompt
mod + EOpen a URL on the screen with the keyboard
mod + UType a Unicode character or emoji
mod + F5Reload the config
mod + EscOpen the kitty shell