Overview¶
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 |
|
Scroll line down |
|
Scroll page up |
|
Scroll page down |
|
Scroll to top |
|
Scroll to bottom |
|
Tabs¶
Action |
Shortcut |
---|---|
New tab |
|
Close tab |
|
Next tab |
|
Previous tab |
|
Next layout |
|
Move tab forward |
|
Move tab backward |
|
Set tab title |
|
Windows¶
Action |
Shortcut |
---|---|
New window |
|
New OS window |
|
Close window |
|
Next window |
|
Previous window |
|
Move window forward |
|
Move window backward |
|
Move window to top |
|
Focus specific window |
|
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:
# moves the window into a new OS window
map ctrl+f2 detach_window
# moves the window into a new Tab
map ctrl+f3 detach_window new-tab
# moves the window into the previously active tab
map ctrl+f3 detach_window tab-prev
# moves the window into the tab at the left of the active tab
map ctrl+f3 detach_window tab-left
# asks which tab to move the window into
map ctrl+f4 detach_window ask
Similarly, you can detach the current tab, with:
# moves the tab into a new OS window
map ctrl+f2 detach_tab
# asks which OS Window to move the tab into
map ctrl+f4 detach_tab ask
Finally, you can define a shortcut to close all windows in a tab other than the currently active window:
map f9 close_other_windows_in_tab
Other keyboard shortcuts¶
The full list of actions that can be mapped to key presses is available here.
Action |
Shortcut |
---|---|
Copy to clipboard |
|
Paste from clipboard |
|
Paste from selection |
|
Increase font size |
|
Decrease font size |
|
Restore font size |
|
Toggle fullscreen |
|
Toggle maximized |
|
Input unicode character |
|
Click URL using the keyboard |
|
Reset the terminal |
|
Reload |
|
Debug |
|
Pass current selection to program |
|
Edit kitty config file |
|
Open a kitty shell |
|
Increase background opacity |
|
Decrease background opacity |
|
Full background opacity |
|
Reset background opacity |
Configuring kitty¶
kitty is highly configurable, everything from keyboard shortcuts to
painting frames-per-second. Press ctrl+shift+f2
in kitty
to open its fully commented sample config file in your text editor.
For details see the configuration docs.
Layouts¶
A layout is an arrangement of multiple kitty windows
inside a top-level OS window. The layout manages all its
windows automatically, resizing and moving them as needed. You can create a new
window using the ctrl+shift+enter
key combination.
Currently, there are seven layouts available:
Fat -- One (or optionally more) windows are 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
Splits -- Windows arranged in arbitrary patterns created using horizontal and vertical splits
Stack -- Only a single maximized window is shown at a time
Tall -- One (or optionally more) windows are shown full height on the left, the rest of the windows are shown one below the other on the right
Vertical -- All windows are shown one below the other
By default, all layouts are enabled and 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. The first layout listed in
enabled_layouts
becomes the default layout.
For more details on the layouts and how to use them see the documentation.
Extending kitty¶
kitty has a powerful framework for scripting. You can create small terminal programs called kittens. These can used to add features to kitty, for example, editing remote files or inputting unicode characters. They can also be used to create programs that leverage kitty's powerful features, for example, viewing images or diffing files with images.
You can create your own kittens to scratch your own itches.
For a list of all the builtin kittens, see here.
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, kitty 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 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
launch --title "Chat with x" 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
# set the --class for the new OS window
os_window_class mywindow
launch sh
# Make the current window the active (focused) window
focus
launch emacs
Note
The launch command when used in a session file cannot create new OS windows, or tabs.
Creating tabs/windows¶
kitty can be told to run arbitrary programs in new tabs, windows or overlays at a keypress. To learn how to do this, see here.
Mouse features¶
You can 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 triple click while holding ctrl+alt to select from clicked point to end of line.
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 middle click to paste from 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.
All these actions can be customized in kitty.conf
as described
here.
You can also customize what happens when clicking on hyperlinks in kitty, having it open files in your editor, download remote files, open things in your browser, etc.
For details, see here.
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 want to use it with an editor such as vim to get more powerful features, you can see tips for doing so, in this thread.
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.
Marks¶
kitty has the ability to mark text on the screen based on regular expressions. This can be useful to highlight words or phrases when browsing output from long running programs or similar. To learn how this feature works, see Mark text on screen.