kitty - the fast, featureful, GPU based terminal emulator¶
- Offloads rendering to the GPU for lower system load and buttery smooth scrolling. Uses threaded rendering to minimize input latency.
- Supports all modern terminal features: graphics (images), unicode, true-color, OpenType ligatures, mouse protocol, focus tracking, bracketed paste and several new terminal protocol extensions.
- Supports tiling multiple terminal windows side by side in different layouts without needing to use an extra program like tmux
- Can be controlled from scripts or the shell prompt, even over SSH.
- Has a framework for Kittens, small terminal programs that can be used to extend kitty's functionality. For example, they are used for Unicode input, Hints and Side-by-side diff.
- Supports startup sessions which allow you to specify the window/tab layout, working directories and programs to run on startup.
- Cross-platform: kitty works on Linux and macOS, but because it uses only OpenGL for rendering, it should be trivial to port to other Unix-like platforms.
- Allows you to open the scrollback buffer in a separate window using arbitrary programs of your choice. This is useful for browsing the history comfortably in a pager or editor.
- Has multiple copy/paste buffers, like vim.
Quickstart¶
Pre-built binaries of kitty are available for both macOS and Linux. See the binary install instructions. You can also build from source.
You can also use your favorite package manager to install the kitty package. kitty packages are available for: macOS with Homebrew (Cask), macOS and Linux with Nix, Ubuntu, Debian, openSUSE, Arch Linux, Gentoo, Fedora, Void Linux, and Solus.
See Configuring kitty for help on configuring kitty and Invocation for the command line arguments kitty supports.
Contents
- kitty - the fast, featureful, GPU based terminal emulator
Design philosophy¶
kitty is designed for power keyboard users. To that end all its controls work with the keyboard (although it fully supports mouse interactions as well). Its configuration is a simple, human editable, single file for easy reproducibility (I like to store configuration in source control).
The code in kitty is designed to be simple, modular and hackable. It is written in a mix of C (for performance sensitive parts) and Python (for easy hackability of the UI). It does not depend on any large and complex UI toolkit, using only OpenGL for rendering everything.
Finally, kitty is designed from the ground up to support all modern terminal features, such as unicode, true color, bold/italic fonts, text formatting, etc. It even extends existing text formatting escape codes, to add support for features not available elsewhere, such as colored and styled (curly) underlines. One of the design goals of kitty is to be easily extensible so that new features can be added in the future with relatively little effort.
Tabs and Windows¶
kitty is capable of running multiple programs organized into tabs and windows. The top level of organization is the Tab. Each tab consists of one or more windows. The windows can be arranged in multiple different layouts, like windows are organized in a tiling window manager. The keyboard controls (which are all customizable) for tabs and windows are:
Scrolling¶
Action | Shortcut |
---|---|
Scroll line up | ctrl+shift+up (also ⌥+⌘+⇞ and ⌘+↑ on macOS) |
Scroll line down | ctrl+shift+down (also ⌥+⌘+⇟ and ⌘+↓ on macOS) |
Scroll page up | ctrl+shift+page_up (also ⌘+⇞ on macOS) |
Scroll page down | ctrl+shift+page_down (also ⌘+⇟ on macOS) |
Scroll to top | ctrl+shift+home (also ⌘+↖ on macOS) |
Scroll to bottom | ctrl+shift+end (also ⌘+↘ on macOS) |
Tabs¶
Action | Shortcut |
---|---|
New tab | ctrl+shift+t (also ⌘+t on macOS) |
Close tab | ctrl+shift+q (also ⌘+w on macOS) |
Next tab | ctrl+shift+right (also ^+⇥ and ⇧+⌘+] on macOS) |
Previous tab | ctrl+shift+left (also ⇧+^+⇥ and ⇧+⌘+[ on macOS) |
Next layout | ctrl+shift+l |
Move tab forward | ctrl+shift+. |
Move tab backward | ctrl+shift+, |
Set tab title | ctrl+shift+alt+t (also ⇧+⌘+i on macOS) |
Windows¶
Action | Shortcut |
---|---|
New window | ctrl+shift+enter (also ⌘+↩ on macOS) |
New OS window | ctrl+shift+n (also ⌘+n on macOS) |
Close window | ctrl+shift+w (also ⇧+⌘+d on macOS) |
Next window | ctrl+shift+] |
Previous window | ctrl+shift+[ |
Move window forward | ctrl+shift+f |
Move window backward | ctrl+shift+b |
Move window to top | ctrl+shift+` |
Focus specific window | ctrl+shift+1 , ctrl+shift+2 ... ctrl+shift+0
(also ⌘+1, ⌘+2 ... ⌘+9 on macOS)
(clockwise from the top-left) |
Additionally, you can define shortcuts in kitty.conf
to focus neighboring
windows and move windows around (similar to window movement in vim):
map ctrl+left neighboring_window left
map shift+left move_window right
map ctrl+down neighboring_window down
map shift+down move_window up
...
You can also define a shortcut to switch to the previously active window:
map ctrl+p nth_window -1
nth_window
will focus the nth window for positive numbers and the
previously active windows for negative numbers.
You can define shortcuts to detach the current window and move it to another tab or another OS window:
map ctrl+f2 detach_window # moves the window into a new OS window
map ctrl+f3 detach_window new-tab # moves the window into a new Tab
map ctrl+f4 detach_window ask # asks which tab to move the window into
Similarly, you can detach the current tab, with:
map ctrl+f2 detach_tab # moves the tab into a new OS window
map ctrl+f4 detach_tab ask # asks which OS Window to move the tab into
Other keyboard shortcuts¶
Action | Shortcut |
---|---|
Copy to clipboard | ctrl+shift+c (also ⌘+c on macOS) |
Paste from clipboard | ctrl+shift+v (also ⌘+v on macOS) |
Paste from selection | ctrl+shift+s |
Increase font size | ctrl+shift+equal (also ⌘++ on macOS) |
Decrease font size | ctrl+shift+minus (also ⌘+- on macOS) |
Restore font size | ctrl+shift+backspace (also ⌘+0 on macOS) |
Toggle fullscreen | ctrl+shift+f11 (also ^+⌘+f on macOS) |
Toggle maximized | ctrl+shift+f10 |
Input unicode character | ctrl+shift+u |
Click URL using the keyboard | ctrl+shift+e |
Reset the terminal | ctrl+shift+delete |
Pass current selection to program | ctrl+shift+o |
Edit kitty config file | ctrl+shift+f2 |
Open a kitty shell | ctrl+shift+escape |
Increase background opacity | ctrl+shift+a>m |
Decrease background opacity | ctrl+shift+a>l |
Full background opacity | ctrl+shift+a>1 |
Reset background opacity | ctrl+shift+a>d |
Layouts¶
A layout is an arrangement of multiple windows. You can create a new window
using the ctrl+shift+enter
key combination.
Currently, there are five layouts available,
- Stack -- Only a single maximized window is shown at a time
- Tall -- One window is shown full height on the left, the rest of the windows are shown one below the other on the right
- Fat -- One window is shown full width on the top, the rest of the windows are shown side-by-side on the bottom
- Grid -- All windows are shown in a grid
- Horizontal -- All windows are shown side-by-side
- Vertical -- All windows are shown one below the other
You can switch between layouts using the ctrl+shift+l
key combination. You can
also create shortcuts to select particular layouts, and choose which layouts
you want to enable/disable, see Layout management for examples.
You can resize windows inside layouts. Press ctrl+shift+r
(also ⌘+r on macOS) to
enter resizing mode and follow the on-screen instructions. In a given window
layout only some operations may be possible for a particular window. For
example, in the Tall layout you can make the first window wider/narrower, but
not taller/shorter. Note that what you are resizing is actually not a window,
but a row/column in the layout, all windows in that row/column will be resized.
You can also define shortcuts in kitty.conf
to make the active window
wider, narrower, taller, or shorter by mapping to the resize_window
action, for example:
map ctrl+left resize_window narrower
map ctrl+right resize_window wider
map ctrl+up resize_window taller
map ctrl+down resize_window shorter 3
The resize_window
action has a second, optional argument to control
the resizing increment (a positive integer that defaults to 1).
Some layouts take options to control their behavior. For example, the fat
and tall
layouts accept the bias
option to control how the available
space is split up. To specify the option, in kitty.conf
use:
enabled_layouts tall:bias=70
This will make the tall window occupy 70%
of available width. bias
can be
any number between 10 and 90.
Writing a new layout only requires about a hundred lines of code, so if there is some layout you want, take a look at layout.py and submit a pull request!
Kittens¶
kitty has a framework for easily creating terminal programs that make use of its advanced features. These programs are called kittens. They are used both to add features to kitty itself and to create useful standalone programs. Some prominent kittens:
- icat
- Display images in the terminal
- diff
- A fast, side-by-side diff for the terminal with syntax highlighting and images
- Unicode Input
- Easily input arbitrary unicode characters in kitty by name or hex code.
- Hints
- Select and open/paste/insert arbitrary text snippets such as URLs, filenames, words, lines, etc from the terminal screen.
- Panel
- Draw a GPU accelerated dock panel on your desktop showing the output from an arbitrary terminal program.
- Clipboard
- Copy/paste to the clipboard from shell scripts, even over SSH.
You can also Learn to create your own kittens.
Configuring kitty¶
kitty is highly configurable, everything from keyboard shortcuts to
painting frames-per-second. For details and a sample kitty.conf
,
see the configuration docs.
Remote control¶
kitty has a very powerful system that allows you to control it from the shell prompt, even over SSH. You can change colors, fonts, open new windows, tabs, set their titles, change window layout, get text from one window and send text to another, etc, etc. The possibilities are endless. See the tutorial to get started.
Startup Sessions¶
You can control the tabs, window layout, working directory, startup programs,
etc. by creating a "session" file and using the kitty --session
command line flag or the startup_session
option in kitty.conf
.
For example:
# Set the window layout for the current tab
layout tall
# Set the working directory for windows in the current tab
cd ~
# Create a window and run the specified command in it
launch zsh
# Create a window with some environment variables set and run
# vim in it
launch env FOO=BAR vim
# Set the title for the next window
title Chat with x
launch irssi --profile x
# Create a new tab (the part after new_tab is the optional tab
# name which will be displayed in the tab bar, if omitted, the
# title of the active window will be used instead)
new_tab my tab
cd ~/somewhere
# Set the layouts allowed in this tab
enabled_layouts tall, stack
# Set the current layout
layout stack
launch zsh
# Create a new OS window
new_os_window
# set new window size to 80x25 cells
os_window_size 80c 25c
launch sh
# Make the current window the active (focused) window
focus
launch emacs
Mouse features¶
- You can hold down ctrl+shift and click on a URL to open it in a browser.
- You can double click to select a word and then drag to select more words.
- You can triple click to select a line and then drag to select more lines.
- You can right click to extend a previous selection.
- You can hold down ctrl+alt and drag with the mouse to select in columns.
- Selecting text automatically copies it to the primary clipboard (on platforms with a primary clipboard).
- You can select text with kitty even when a terminal program has grabbed the mouse by holding down the shift key.
Font control¶
kitty has extremely flexible and powerful font selection features. You can specify individual families for the regular, bold, italic and bold+italic fonts. You can even specify specific font families for specific ranges of unicode characters. This allows precise control over text rendering. It can come in handy for applications like powerline, without the need to use patched fonts. See the various font related configuration directives in Fonts.
The scrollback buffer¶
kitty supports scrolling back to view history, just like most terminals. You
can use either keyboard shortcuts or the mouse scroll wheel to do so. However,
kitty has an extra, neat feature. Sometimes you need to explore the
scrollback buffer in more detail, maybe search for some text or refer to it
side-by-side while typing in a follow-up command. kitty allows you to do this
by pressing the ctrl+shift+h
key-combination, which will open the
scrollback buffer in your favorite pager program (which is less
by default).
Colors and text formatting are preserved. You can explore the scrollback buffer
comfortably within the pager.
Additionally, you can pipe the contents of the scrollback buffer to an arbitrary, command running in a new window, tab or overlay, for example:
map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting less +G -R
Would open the scrollback buffer in a new window when you press the F1
key. See ctrl+shift+h
for details.
If you wish to store very large amounts of scrollback to view using the piping or
ctrl+shift+h
features, you can use the scrollback_pager_history_size
option.
Multiple copy/paste buffers¶
In addition to being able to copy/paste from the system clipboard, in kitty you
can also setup an arbitrary number of copy paste buffers. To do so, simply add
something like the following to your kitty.conf
:
map f1 copy_to_buffer a
map f2 paste_from_buffer a
This will allow you to press F1 to copy the current selection to an
internal buffer named a
and F2 to paste from that buffer. The buffer
names are arbitrary strings, so you can define as many such buffers as you
need.
Frequently Asked Questions¶
The list of Frequently Asked Questions (FAQ) is available here.
Completion for kitty¶
kitty comes with completion for the kitty
command for popular shells.
bash¶
Add the following to your ~/.bashrc
source <(kitty + complete setup bash)
Older versions of bash (for example, v3.2) do not support process substitution with the source command, in which case you can try an alternative:
source /dev/stdin <<<"$(kitty + complete setup bash)"