Kitty - Terminal Emulator

Tmux-Style Tabs & Split-Panes

Terminal
Published

April 8, 2023

Modified

February 29, 2024

Kitty terminal emulator 1

Figure 1: Kitty with minimalistic grey-scale tap-bar

Configuration

Maintain the Kitty configuration in a version control system (VCS) …in this example in a path defined by the environment variables $SCRIPTS:

>>> tree $SCRIPTS/etc/kitty
├── kitty.conf
└── kitty.d
    ├── color.conf
    ├── cursor.conf
    ├── font.conf
    ├── keyboard.conf
    ├── tabs.conf
    └── window.conf

Link to configuration in the VCS with the following commands

test -d ~/.config/kitty && rm -rf ~/.config/kitty
test -L ~/.config/kitty ||
       ln -s $SCRIPTS/etc/kitty ~/.config/kitty

Use kitty.conf to load configuration drop-in files from a kitty.d/ sub-directory:

globinclude kitty.d/**/*.conf

Visual Appearance

Configuration for the visual style illustrated in Figure 1:

tab_bar_edge            top
tab_title_template      "{index}:{title}"
active_tab_foreground   #fff
active_tab_background   #000
inactive_tab_foreground #737373
inactive_tab_background #e6e6e6
tab_bar_margin_height   0.5 0.5
tab_bar_margin_color    #bfbfbf
active_border_color     #000
inactive_border_color   #f9f9f9
inactive_text_alpha     0.3

Key Binding

Overwrite the default tabs and windows configuration with key-bindings mapping to the behaviour of Tmux:

# send ctrl+a to shell
map ctrl+a>a send_text all \x01

# create windows
map ctrl+a>minus launch --location=hsplit
map ctrl+a>backslash launch --location=vsplit
map ctrl+a>x close_window

# navigate windows
map ctrl+a>h neighboring_window left
map ctrl+a>l neighboring_window right
map ctrl+a>k neighboring_window up
map ctrl+a>j neighboring_window down

# tabs
map ctrl+a>c launch --cwd=last_reported --type=tab
map ctrl+a>, set_tab_title
map ctrl+a>1 goto_tab 1
map ctrl+a>2 goto_tab 2
map ctrl+a>3 goto_tab 3
map ctrl+a>4 goto_tab 4
map ctrl+a>5 goto_tab 5
map ctrl+a>6 goto_tab 6
map ctrl+a>7 goto_tab 7
map ctrl+a>8 goto_tab 8
map ctrl+a>9 goto_tab 9
map ctrl+a>0 goto_tab 10