PRIMARY CATEGORY → SETUP

kitty → Fast and Feature-Rich GPU Based Terminal Emulator

It is an enhanced terminal with a tabbed/tiling structure focused in performance and customization

Each tab can be divided into several panes/windows

Some of this features are →

  • Multiple Instances and Windows
  • Setting of Keybinds/Hotkeys via a simple configuration file
  • Image and Emojis Display
$ kitty +kitten icat /path/to/image

  • SSH Protocol support
$ kitty +kitten ssh user@hostname

Note that the above commands use the syntax kitty +kitten

kittens are small integrated programs that extend kitty’s capacity - See here

kitty is launched by the sxhkd daemon when a certain input event, such as a Hotkey, is performed

# ~/.config/sxhkd/sxhkdrc - Kitty Launch Hotkey
super + Return
  /opt/kitty/bin/kitty

Configuration File → ~/.config/kitty/kitty.conf

More information here

💫 Awesome Documentation → Kitty Site


Installation

Download the binary and its related files from the project’s release page. The required one, in this Environment Setup is the Linux amd64 binary bundle

Being root

$ mkdir /opt/kitty
$ mv /home/al3xbb/Downloads/kitty-0.36.2-x86_64.txz !$
$ cd !$ && tar --extract --verbose --file kitty-0.36.2-x86_64.txz
$ rm -i -- !$

That’s it

$ command -V kitty
kitty is /opt/kitty/bin/kitty

As for the kitty’s Configuration File, It need to be created

Just create it in ~/.config/kitty and paste this Configuration File’s content into it →

$ nvim ~/.config/kitty/kitty.conf # Or {nano,vi,emacs,vim...}

Moreover, as mentioned below, a color.ini file must also be created in the ~/.config/kitty directory to apply various terminal colours

Copy the Color.ini file from here and paste into it →

$ nvim ~/.config/kitty/color.ini

Once the above is done, as Root, copy the entire /home/al3xbb/.config/kitty directory’s content into his kitty’s configuration directory

$ cp /home/al3xbb/.config/kitty/* ~/.config/kitty/
Hack Nerd Fonts

See here to download them

To install them, as root

$ mv /home/al3xbb/Downloads/Hack.zip /usr/local/share/fonts
$ cd !$
$ 7z x Hack.zip # Or unzip
$ rm -i -- {LICENSE,README}.md !$

Once installed, just check in the kitty.conf file that the font_family parameter is set as follows →

Reference

font_family HackNerdFont

More info here


Configuration File

Kitty.conf Configuration File Sample Fully documented

kitty.conf → Copy from here the kitty’s Full Customised Configuration File

color.ini → Likewise, copy from here the kitty’s Colours File

Configuration File Documentation → kitty.conf


Parameters

Font

Reference

Several parameters related to the kitty terminal’s font such as the font_family or font_size can be specificed in the kitty.conf configuration file

Take a look at this installation for more information

Shell

Reference

This Enviroment Setup make use of a ZSH as the Default Shell

Then, It’s necessary to tell it to Kitty. This can be done via the shell parameter

shell zsh
Background Opacity

Reference

The kitty terminal’s opacity is set by the background_opacity parameter

Its value ranges from 0, fully transparent, to 1, opaque

background_opacity 0.55
Colours

Regarding the kitty terminal’s colours, a .ini file is included in the kitty.conf

include color.ini

Get the color.ini file content here


Actions and Default Shortcuts

All mappable actions here

All default shortcuts here related to Windows, Tabs, Layouts…


Custom Shortcuts ~ TL;DR

Layouts

Reference

Windows

Reference

Tabs

Reference

ActionShortcut
Tab CreationC-S-t
Tab ClosingC-S-q
Tab DetachC-M-o
Tab RenameC-M-S-t
Tab Movement (Backward ~ Forward) ⬅️➡️C-{S-TAB,TAB}
Tab Focus (Previous - Next) ⬅️➡️C-S{commma,dot}
Misc

Reference

ActionShortcut
Paginate last Command OutputC-S-g
Clear Screen and Scrollback BufferC-l
Copy to ClipboardC-S-c
Paste from ClipboardC-S-v
Copy to Buffer Af1
Paste from Buffer Af2
Copy to Buffer Bf3
Paste from Buffer Bf4
Increase/Decrease Font SizeC-S-{plus,minus} (Block-Num)
Restore Font SizeC-S-Backspace

Custom Shortcuts

Note that, as mentioned earlier, a keybind is mapped to a specific action

Keybind → Action

map KEYBIND ACTION # An Action may has arguments
Layouts Management

Types of Layout

All the Layouts are enabled by default. To switch between them use default shorcut → C-S-l

In the configuration file, the selected ones are the Splits Layout and the Stack Layout

Most of the mappeable actions used there have been implemented in the kitty.conf file, such as the below ones

enabled_layouts splits,stack

As mentioned in the reference link above, the Splits Layout is the most flexible layout

The Stack Layout is simple enabled to allow zooming in and out a specific Window, i.e. switching between the two layouts via the toogle_layout mappeable action below

Switch to Stack Layout (Window Zoom {in,out}) → C-S-z

Reference

Switch to Stack Layout

map ctrl+shift+z toggle_layout stack
Split Rotation → C-S-o

Shown in the Split Layout Section

map ctrl+shift+o layout_action rotate

Basically rotates the current Windows Split (i.e. Horizonal ↔ Vertical)

Window Management

Most of the mappeable actions below are implemented in the Split Layout Section

Window Split

Different types of Split are implemented through the launch action

  • Vertical SplitC-S-enter
map ctrl+shift+enter launch --location=vsplit --cwd=current
  • Horizontal SplitC-S-dash/hyphen
map ctrl+shift+- launch --location=hsplit --cwd=current
  • Adaptative SplitC-S-plus
map ctrl+shift++ launch --location=split --cwd=current

The --cwd=current option of the launch action causes the terminal of the newly generated window to retain the previous CWD

CWD → Current Work Directory

Windows Movement → C-M-{k,h,l,j}

Reference

Moves the Windows in the specificed direction. It is like a Windows Exchange

Actionmove_window

map ctrl+alt+k move_window up
map ctrl+alt+h move_window left
map ctrl+alt+l move_window right
map ctrl+alt+j move_window down

Windows Focus → C-S-{k,h,l,j}

Reference

Move the Focus in the specified selection between the adjacent Windows in the current Tab

Actionneighboring_window

map ctrl+shift+h neighboring_window left
map ctrl+shift+l neighboring_window right
map ctrl+shift+k neighboring_window up
map ctrl+shift+j neighboring_window down

Windows Resize → M-S-{k,h,l,j,r}

Reference

Default Shorcut to enter the Windows Resize ModeC-S-r

Thus, the Window is resized using:

  • w → Wider
  • n → Narrower
  • t → Taller
  • s → Shorter
  • r → Reset Windows Size

To resize a Windows in a customised way, use the resize_window action

As mentioned earlier, Nvim-like Motions are used to increase efficiency. Therefore, instead of use the above ones, use these →

map alt+shift+h resize_window wider 3
map alt+shift+l resize_window narrower 3
map alt+shift+k resize_window taller 3
map alt+shift+j resize_window shorter 3

To reset all Windows to their initial size, use the reset option in the resize_window actions rather than a specific motion

map alt+shift+r resize_window reset
Windows Detach → M-S-w

Reference

Completely detach a Window in a new Window OS

Actionsdetach_window

See here

map alt+shift+w detach_window

Tab Management
Tab Creation → C-S-t

Reference

Default shortcut to open a new tab → C-S-t

The above one keybind is overwritten in the Configuration File by the new_tab_witch_cmd mappeable action

This allows to create a new tab while keeping the CWD

map ctrl+shift+t new_tab_with_cwd
Tab Detach → C-M-o

Reference

Completely detach a tab in a new Window OS

Actiondetach_tab

See here

map ctrl+alt+o detach_tab

Copy ~ Paste

Reference

Traditional Clipboards → C-S-{c,v}

This environment setup make use of several Copy/Paste mappeable actions such as:

The above ones are mapped with the default shortcuts

Additional Clipboards (Buffers) → {f1,f2,f3,f4}

Reference

The customised ones are the related to the Buffers

A Buffer simply is a string that stores the value copied into it. Then, that value can be pasted from the Buffer to any location

In this case, two Buffers are declared in kitty.conf and used →

map f1 copy_to_buffer a # Buffer a
map f2 paste_from_buffer a
map f3 copy_to_buffer b # Buffer b
map f4 paste_from_buffer b
Miscellaneous
Clear Screen and Scrollback Buffer

Reference

map ctrl+l clear_terminal to_cursor active

In this environment setup, this action is implemented in the zshrc as follows →

Reference

clearScreenAndScrollback () {
	clear && printf '\e[3J' # Or printf "\e[H\e[3J"
	zle && zle .reset-prompt && zle -R # Avoid Screen Element/Prompt Corruption
}
zle -N clearScreenAndScrollback 
bindkey '^L' clearScreenAndScrollback