2016-12-08 07:18:58 +03:00
= kitty - A terminal emulator
:toc:
:toc-placement!:
2016-12-08 08:05:11 +03:00
// START_SHORTCUT_BLOCK
2016-12-08 08:20:47 +03:00
:sc_close_tab: pass:quotes[`ctrl+shift+q`]
:sc_close_window: pass:quotes[`ctrl+shift+w`]
:sc_copy_to_clipboard: pass:quotes[`ctrl+shift+c`]
2017-11-16 08:16:42 +03:00
:sc_decrease_font_size: pass:quotes[`ctrl+shift+minus`]
2018-03-09 18:34:20 +03:00
:sc_edit_config_file: pass:quotes[`ctrl+shift+f2`]
2016-12-08 08:20:47 +03:00
:sc_eighth_window: pass:quotes[`ctrl+shift+8`]
:sc_fifth_window: pass:quotes[`ctrl+shift+5`]
:sc_first_window: pass:quotes[`ctrl+shift+1`]
:sc_fourth_window: pass:quotes[`ctrl+shift+4`]
2017-11-16 08:16:42 +03:00
:sc_increase_font_size: pass:quotes[`ctrl+shift+equal`]
2018-02-08 20:17:17 +03:00
:sc_input_unicode_character: pass:quotes[`ctrl+shift+u`]
2018-04-06 12:29:13 +03:00
:sc_kitty_shell_window: pass:quotes[`ctrl+shift+escape`]
2016-12-08 10:32:58 +03:00
:sc_move_tab_backward: pass:quotes[`ctrl+shift+,`]
:sc_move_tab_forward: pass:quotes[`ctrl+shift+.`]
2016-12-08 09:53:12 +03:00
:sc_move_window_backward: pass:quotes[`ctrl+shift+b`]
:sc_move_window_forward: pass:quotes[`ctrl+shift+f`]
2016-12-08 10:32:58 +03:00
:sc_move_window_to_top: pass:quotes[`ctrl+shift+``]
2017-11-17 14:18:31 +03:00
:sc_new_os_window: pass:quotes[`ctrl+shift+n`]
2016-12-08 08:20:47 +03:00
:sc_new_tab: pass:quotes[`ctrl+shift+t`]
:sc_new_window: pass:quotes[`ctrl+shift+enter`]
:sc_next_layout: pass:quotes[`ctrl+shift+l`]
:sc_next_tab: pass:quotes[`ctrl+shift+right`]
:sc_next_window: pass:quotes[`ctrl+shift+]`]
:sc_ninth_window: pass:quotes[`ctrl+shift+9`]
2017-11-16 08:16:42 +03:00
:sc_pass_selection_to_program: pass:quotes[`ctrl+shift+o`]
2016-12-08 08:20:47 +03:00
:sc_paste_from_clipboard: pass:quotes[`ctrl+shift+v`]
2017-02-10 09:04:38 +03:00
:sc_paste_from_selection: pass:quotes[`ctrl+shift+s` or `shift+insert`]
2016-12-08 08:20:47 +03:00
:sc_previous_tab: pass:quotes[`ctrl+shift+left`]
:sc_previous_window: pass:quotes[`ctrl+shift+[`]
2017-11-16 08:16:42 +03:00
:sc_restore_font_size: pass:quotes[`ctrl+shift+backspace`]
2018-04-12 10:31:16 +03:00
:sc_run_kitten_text_hints: pass:quotes[`ctrl+shift+e`]
2018-04-15 17:34:32 +03:00
:sc_run_kitten_text_hints_type_line_program: pass:quotes[`ctrl+shift+p → l`]
:sc_run_kitten_text_hints_type_path: pass:quotes[`ctrl+shift+p → shift+f`]
:sc_run_kitten_text_hints_type_path_program: pass:quotes[`ctrl+shift+p → f`]
:sc_run_kitten_text_hints_type_word_program: pass:quotes[`ctrl+shift+p → w`]
2016-12-08 08:20:47 +03:00
:sc_scroll_end: pass:quotes[`ctrl+shift+end`]
:sc_scroll_home: pass:quotes[`ctrl+shift+home`]
:sc_scroll_line_down: pass:quotes[`ctrl+shift+down` or `ctrl+shift+j`]
:sc_scroll_line_up: pass:quotes[`ctrl+shift+up` or `ctrl+shift+k`]
:sc_scroll_page_down: pass:quotes[`ctrl+shift+page_down`]
:sc_scroll_page_up: pass:quotes[`ctrl+shift+page_up`]
:sc_second_window: pass:quotes[`ctrl+shift+2`]
2018-03-25 07:25:02 +03:00
:sc_set_tab_title: pass:quotes[`ctrl+shift+alt+t`]
2016-12-08 08:20:47 +03:00
:sc_seventh_window: pass:quotes[`ctrl+shift+7`]
2016-12-10 10:29:20 +03:00
:sc_show_scrollback: pass:quotes[`ctrl+shift+h`]
2016-12-08 08:20:47 +03:00
:sc_sixth_window: pass:quotes[`ctrl+shift+6`]
2018-05-17 12:39:41 +03:00
:sc_start_resizing_window: pass:quotes[`ctrl+shift+r`]
2016-12-08 08:20:47 +03:00
:sc_tenth_window: pass:quotes[`ctrl+shift+0`]
:sc_third_window: pass:quotes[`ctrl+shift+3`]
2017-11-16 08:16:42 +03:00
:sc_toggle_fullscreen: pass:quotes[`ctrl+shift+f11`]
2016-12-08 08:05:11 +03:00
// END_SHORTCUT_BLOCK
2016-12-08 07:18:58 +03:00
2017-01-18 18:44:07 +03:00
++++
<img align="left" role="left" src="logo/kitty.png?raw=true"/>
++++
2016-12-08 07:18:58 +03:00
image::https://travis-ci.org/kovidgoyal/kitty.svg?branch=master[Build status, link=https://travis-ci.org/kovidgoyal/kitty]
2017-01-18 18:50:24 +03:00
== Major Features
2018-02-23 06:43:20 +03:00
* Uses OpenGL for rendering, offloads rendering to the GPU for link:#performance[lower system
load] and buttery smooth scrolling. Uses threaded rendering to minimize input
2018-01-10 12:59:58 +03:00
latency.
2016-12-08 07:29:50 +03:00
2018-02-20 14:02:57 +03:00
* Supports all modern terminal features: link:graphics-protocol.asciidoc[graphics (images)], unicode,
2017-11-12 09:19:42 +03:00
true-color, OpenType ligatures, mouse protocol, focus tracking, bracketed paste and so on.
2016-12-08 07:29:50 +03:00
2018-01-10 12:59:58 +03:00
* Supports tiling multiple terminal windows side by side in different
2018-02-23 06:43:20 +03:00
link:#layouts[layouts] without needing to use an extra program like tmux
2018-01-10 12:59:58 +03:00
2018-02-23 06:43:20 +03:00
* Can be link:remote-control.asciidoc[controlled from scripts or the shell prompt], even over SSH.
2018-01-10 12:59:58 +03:00
2018-02-23 07:06:46 +03:00
* Has a framework for _kittens_, small terminal programs that can be used to extend kitty's functionality.
2018-05-08 05:56:47 +03:00
For example, they are used for link:#unicode-input[Unicode input] and link:#hints[Hints].
2018-02-23 07:06:46 +03:00
2018-02-23 06:43:20 +03:00
* Supports link:#startup-sessions[startup sessions] which allow you to specify the window/tab layout,
2016-12-11 07:18:52 +03:00
working directories and programs to run on startup.
2017-10-20 15:54:13 +03:00
* Cross-platform support: kitty currently works on Linux and macOS, but because
it uses only OpenGL for rendering, it should be trivial to port to other
2017-12-20 06:20:09 +03:00
platforms.
2016-12-08 07:18:58 +03:00
2018-02-23 07:06:46 +03:00
* Allows you to open link:#the-scrollback-buffer[the scrollback buffer] in a separate
2017-11-12 09:19:42 +03:00
window using arbitrary programs of your choice. This is useful for browsing
2018-02-23 07:06:46 +03:00
the history comfortably in a pager or editor.
2017-10-20 15:54:13 +03:00
2017-01-07 08:18:59 +03:00
2018-05-17 21:23:36 +03:00
image::screenshots/screenshot.png?raw=true[Screenshot, showing three programs in the "Tall" layout]
2017-01-07 07:14:57 +03:00
2016-12-08 07:18:58 +03:00
toc::[]
== Installation
kitty is designed to run from source, for easy hackability. Make sure
2016-12-08 07:29:50 +03:00
the following dependencies are installed first.
2016-12-08 07:18:58 +03:00
2017-01-18 18:50:24 +03:00
=== Dependencies
2016-12-08 07:18:58 +03:00
* python >= 3.5
2017-12-20 06:20:09 +03:00
* harfbuzz >= 1.5.0
2017-09-27 15:01:11 +03:00
* zlib
* libpng
2017-12-11 16:39:41 +03:00
* freetype (not needed on macOS)
2017-02-08 19:29:05 +03:00
* fontconfig (not needed on macOS)
2017-10-07 09:25:45 +03:00
* ImageMagick (optional, needed to use the `kitty icat` tool to display images in the terminal)
2018-05-21 06:36:19 +03:00
* pygments (optional, need for syntax highlighting in `kitty +kitten diff`)
2017-01-12 09:28:11 +03:00
* gcc or clang (required only for building)
* pkg-config (required only for building)
2018-04-16 19:21:55 +03:00
* For building on Linux in addition to the above dependencies you might also need to install the `-dev` packages for `xcursor`, `xrandr`, `libxi`, `xinerama`, `libgl1-mesa` and `xkbcommon-x11`, if they are not already installed by your distro.
2016-12-08 07:18:58 +03:00
2017-01-12 09:28:11 +03:00
=== Install and run from source
2016-12-08 07:18:58 +03:00
....
git clone https://github.com/kovidgoyal/kitty && cd kitty
....
2018-04-19 17:12:46 +03:00
Now build the native code parts of kitty with the following command:
2016-12-08 07:18:58 +03:00
....
2018-01-30 13:29:31 +03:00
make
2016-12-08 07:18:58 +03:00
....
You can run kitty, as:
....
2018-01-30 13:29:31 +03:00
python3 .
2016-12-08 07:18:58 +03:00
....
2018-04-21 13:03:21 +03:00
If that works, you can create a script to launch kitty:
....
#!/usr/bin/env python3
import runpy
runpy.run_path('/path/to/kitty/dir', run_name='__main__')
....
And place it in `~/bin` or `/usr/bin` so that you can run kitty using
just `kitty`.
2017-01-10 18:59:16 +03:00
=== Linux packages
2018-04-25 22:13:17 +03:00
* Arch Linux: https://www.archlinux.org/packages/community/x86_64/kitty/
2017-12-20 02:11:02 +03:00
2018-04-25 22:13:17 +03:00
* Arch Linux: AUR git package https://aur.archlinux.org/packages/kitty-git/
2017-01-10 18:59:16 +03:00
2017-10-26 13:10:01 +03:00
* NixOS / nixpkgs: https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/kitty/default.nix
2018-02-06 19:39:35 +03:00
* Gentoo: https://packages.gentoo.org/packages/x11-terms/kitty
2017-01-10 18:59:16 +03:00
2018-03-23 12:45:42 +03:00
* openSUSE: https://build.opensuse.org/package/show/X11:terminals/kitty
2018-04-19 17:12:46 +03:00
* Debian: https://packages.qa.debian.org/k/kitty/news/20180419T070013Z.html
2017-01-18 18:56:48 +03:00
=== macOS packages
2017-01-12 09:28:11 +03:00
2017-02-02 14:05:02 +03:00
kitty is available as a macOS `dmg` file for easy installation from the
link:../../releases[releases page]. You can also run kitty directly from
source using the above install from source instructions, after installing its
2017-11-20 11:39:13 +03:00
dependencies using http://brew.sh/[brew] or a similar package manager.
2017-01-12 09:28:11 +03:00
2016-12-08 07:18:58 +03:00
== 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
2017-04-29 16:55:57 +03:00
well). Its configuration is a simple, human editable, single file for
2017-09-16 05:40:19 +03:00
easy reproducibility (I like to store config files in source control).
2016-12-08 07:18:58 +03:00
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
2017-02-08 19:29:05 +03:00
UI toolkit, using only OpenGL for rendering everything.
2016-12-08 07:18:58 +03:00
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 less 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
2016-12-08 07:29:50 +03:00
of one or more _windows_. The windows can be arranged in multiple
2016-12-08 07:18:58 +03:00
different layouts, like windows are organized in a tiling window
manager. The keyboard controls (which are all customizable) for tabs and
windows are:
2016-12-10 10:29:20 +03:00
[[scrolling-shortcuts]]
2016-12-08 07:29:50 +03:00
[options="header"]
2017-01-18 18:50:24 +03:00
=== Scrolling
2016-12-08 07:29:50 +03:00
|===
2016-12-08 07:18:58 +03:00
|Action |Shortcut
2016-12-08 07:29:50 +03:00
2016-12-08 08:20:47 +03:00
|Scroll line up | {sc_scroll_line_up}
|Scroll line down | {sc_scroll_line_down}
|Scroll page up | {sc_scroll_page_up}
|Scroll page down | {sc_scroll_page_down}
|Scroll to top | {sc_scroll_home}
|Scroll to bottom | {sc_scroll_end}
|===
[options="header"]
2017-01-18 18:50:24 +03:00
=== Tabs
2016-12-08 08:20:47 +03:00
|===
|Action |Shortcut
2016-12-08 08:05:11 +03:00
2016-12-08 08:20:47 +03:00
|New tab | {sc_new_tab}
2016-12-08 08:05:11 +03:00
|Close tab | {sc_close_tab}
2016-12-08 08:20:47 +03:00
|Next tab | {sc_next_tab}
|Previous tab | {sc_previous_tab}
|Next layout | {sc_next_layout}
2016-12-08 10:32:58 +03:00
|Move tab forward | {sc_move_tab_forward}
|Move tab backward | {sc_move_tab_backward}
2018-03-25 07:25:02 +03:00
|Set tab title | {sc_set_tab_title}
2016-12-08 08:05:11 +03:00
2016-12-08 08:20:47 +03:00
|===
[options="header"]
2017-01-18 18:50:24 +03:00
=== Windows
2016-12-08 08:20:47 +03:00
|===
|Action |Shortcut
|New window | {sc_new_window}
2017-11-17 14:18:31 +03:00
|New OS window| {sc_new_os_window}
2016-12-08 08:20:47 +03:00
|Close window | {sc_close_window}
|Next window | {sc_next_window}
|Previous window | {sc_previous_window}
2016-12-08 09:53:12 +03:00
|Move window forward | {sc_move_window_forward}
|Move window backward | {sc_move_window_backward}
2016-12-08 10:04:40 +03:00
|Move window to top | {sc_move_window_to_top}
2016-12-08 08:53:53 +03:00
|Focus specific window (windows are counted clockwise from the top left corner) | {sc_first_window}, {sc_second_window} ... {sc_tenth_window}
2016-12-08 08:05:11 +03:00
2016-12-08 07:29:50 +03:00
|===
2016-12-08 07:18:58 +03:00
2017-11-16 08:16:42 +03:00
=== Miscellaneous
|===
|Action |Shortcut
|Increase font size | {sc_increase_font_size}
|Decrease font size | {sc_decrease_font_size}
2017-12-20 06:20:09 +03:00
|Restore font size | {sc_restore_font_size}
2017-11-16 08:16:42 +03:00
|Toggle fullscreen | {sc_toggle_fullscreen}
2018-02-08 20:17:17 +03:00
|Input unicode character | {sc_input_unicode_character}
2018-02-14 14:48:57 +03:00
|Click URL using the keyboard | {sc_run_simple_kitten_text_url_hints}
2017-11-16 08:16:42 +03:00
|Pass current selection to program | {sc_pass_selection_to_program}
2018-04-06 12:29:13 +03:00
|Edit kitty config file | {sc_edit_config_file}
|Open a kitty shell | {sc_kitty_shell}
2017-11-16 08:16:42 +03:00
|===
2018-01-10 10:24:21 +03:00
== Controlling kitty from scripts
You can control kitty from the command line/scripts by sending it messages.
You can tell kitty to open/close/rename tabs and windows. You can even send
2018-03-14 05:31:10 +03:00
arbitrary input/text to any specified window. Messages can be sent using `kitty
@`. Note that you must set `allow_remote_control yes` in your
link:kitty/kitty.conf[kitty.conf] to use this feature. It even works over SSH
connections. This feature is best illustrated with a
link:remote-control.asciidoc[tutorial].
2018-01-10 10:24:21 +03:00
2016-12-08 08:20:47 +03:00
2016-12-10 10:29:20 +03:00
== The scrollback buffer
kitty supports scrolling back to view history, just like most terminals. You
can use either the <<scrolling-shortcuts,keyboard shortcuts>> or the mouse
2018-02-03 12:28:34 +03:00
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
2016-12-10 10:29:20 +03:00
text or refer to it side-by-side while typing in a follow-up command. kitty
allows you to do this by pressing the {sc_show_scrollback} key-combination,
2018-02-03 12:28:34 +03:00
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 pager comfortably within the pager.
2016-12-10 10:29:20 +03:00
2018-02-23 07:08:07 +03:00
== Unicode input
2018-02-23 07:06:46 +03:00
You can input unicode characters by name, hex code, recently used and even an editable favorites list.
Press {sc_input_unicode_character} to start the unicode input widget, shown below.
2018-05-17 21:23:36 +03:00
image::screenshots/unicode.png?raw=true[Unicode input widget, showing selection of unicode characters by name]
2018-02-23 07:06:46 +03:00
2018-02-27 21:59:11 +03:00
In Code mode, you enter a unicode character by typing in the hex code for the
character and pressing enter, for example, type in 2716 and press enter to get
✖. You can also choose a character from the list of recently used characters by
typing a leading period and then the two character index and pressing Enter.
In Name mode you instead type words from the character name and use the arrow
keys/tab to select the character from the displayed matches. You can also type
a leading period and the index for the match if you dont like to use arrow
keys.
2018-04-12 10:31:16 +03:00
== Hints
2018-02-23 07:06:46 +03:00
2018-04-12 10:31:16 +03:00
kitty has a _hints mode_ to select and act on arbitrary text snippets currently
visible on the screen. For example, you can press {sc_run_kitten_text_hints}
to choose any URL visible on the screen and then open it using your system
browser.
2018-02-23 07:06:46 +03:00
2018-05-17 21:23:36 +03:00
image::screenshots/hints_mode.png?raw=true[URL hints mode]
2018-02-23 07:06:46 +03:00
2018-04-15 17:34:32 +03:00
Similarly, you can press {sc_run_kitten_text_hints_type_path_program} to
2018-04-12 10:31:16 +03:00
select anything that looks like a path or filename and then insert it into the
terminal, very useful for picking files from the output of a git or ls command and
adding them to the command line for the next command.
The hints kitten is very powerful to see more detailed help on its various
options and modes of operation, use: `kitty +kitten hints --help`.
2016-12-10 10:33:33 +03:00
== Miscellaneous features
2018-03-15 09:50:46 +03:00
* You can also hold down `ctrl+shift` and click on a URL to open it in a browser.
* You can double click to select a word and triple click to select a line.
* You can right click to extend a previous selection
2016-12-10 10:33:33 +03:00
2016-12-11 07:18:52 +03:00
== Layouts
2018-01-31 15:43:36 +03:00
Currently, there are five layouts available,
2016-12-11 07:18:52 +03:00
* Stack -- Only a single maximized window is shown at a time
2018-01-23 17:05:30 +03:00
* Tall -- One window is shown full height on the left, the rest of the windows are shown one below the other on the right
2018-05-10 20:00:29 +03:00
* Fat -- One window is shown full width on the top, the rest of the windows are shown side-by-side on the bottom
2017-12-01 09:53:57 +03:00
* Grid -- All windows are shown in a grid
2018-01-23 17:05:30 +03:00
* Horizontal -- All windows are shown side-by-side
* Vertical -- All windows are shown one below the other
2016-12-11 07:18:52 +03:00
2018-03-10 21:08:18 +03:00
You can switch between layouts using the {sc_next_layout} key combination. You can
also create shortcuts to select particular layouts, and choose which layouts
2018-03-14 05:31:10 +03:00
you want to enable/disable, see link:kitty/kitty.conf[kitty.conf] for examples.
2016-12-11 07:18:52 +03:00
2018-05-17 12:39:41 +03:00
You can resize windows inside layouts. Press {sc_start_resizing_window} to
2018-05-17 20:56:41 +03:00
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.
2018-05-17 12:39:41 +03:00
2018-05-16 11:32:58 +03:00
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
```
2018-05-17 12:39:41 +03:00
This will make the tall window occupy `70%` of available width. `bias` can be
2018-05-16 11:32:58 +03:00
any number between 10 and 90.
2018-05-17 13:32:42 +03:00
Writing a new layout only requires about a hundred lines of code, so if there is
2016-12-11 07:18:52 +03:00
some layout you want, take a look at link:kitty/layout.py[layout.py] and submit
a pull request!
2016-12-08 07:18:58 +03:00
== Configuration
2018-03-14 05:31:10 +03:00
kitty is highly customizable, everything from keyboard shortcuts, to painting
frames-per-second. See the heavily commented link:kitty/kitty.conf[default
2018-03-25 09:17:11 +03:00
config file] for an overview of all customization possibilities.
By default kitty looks for a config file in the OS config directories (usually
`~/.config/kitty/kitty.conf` and additionally
2017-01-18 19:07:16 +03:00
`~/Library/Preferences/kitty/kitty.conf` on macOS) but you can pass a specific
2018-03-14 05:31:10 +03:00
path via the `--config` option or use the `KITTY_CONFIG_DIRECTORY` environment
2018-03-25 09:17:11 +03:00
variable. See the help for the `--config` option in `kitty --help` for full
2018-04-11 17:49:03 +03:00
details. You can also dump the current configuration using the `--debug-config`
option.
2018-03-25 09:17:11 +03:00
2016-12-08 07:18:58 +03:00
== Startup Sessions
You can control the tabs, window layout, working directory, startup
programs, etc. by creating a "session" file and using the `--session`
command line flag. For example:
....
# Set the window layout for the current tab
layout tall
2018-01-08 10:08:01 +03:00
# Set the working directory for windows in the current tab
2016-12-08 07:18:58 +03:00
cd ~
# Create a window and run the specified command in it
launch zsh
launch vim
2018-01-08 10:17:47 +03:00
# Set the title for the next window
title Chat with x
2016-12-08 07:18:58 +03:00
launch irssi --profile x
# Create a new tab (the part after new_tab is the optional tab name which will
2017-01-08 09:59:56 +03:00
# be displayed in the tab bar, if omitted, the title of the active window will
2016-12-08 07:18:58 +03:00
# be used instead)
new_tab my tab
cd ~/somewhere
# Set the layouts allowed in this tab
enabled_layouts tall, stack
2016-12-11 06:29:00 +03:00
# Set the current layout
2016-12-08 07:18:58 +03:00
layout stack
launch zsh
# Make the current window the active (focused) window
focus
launch emacs
....
2017-01-17 10:28:31 +03:00
== Protocol Extensions
kitty has a few extensions to the xterm protocol, to enable advanced features,
see link:protocol-extensions.asciidoc[Protocol Extensions].
2017-02-09 19:08:05 +03:00
== 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 the
link:kitty/kitty.conf[config file].
2017-08-26 07:54:12 +03:00
== Performance
2017-08-26 07:55:50 +03:00
The main goals for kitty performance are user perceived latency while typing
2017-09-16 05:40:19 +03:00
and "smoothness" while scrolling as well as CPU usage. kitty tries hard to find
an optimum balance for these. To that end it keeps a cache of each rendered
glyph in video RAM so that font rendering is not a bottleneck. Interaction
with child programs takes place in a separate thread from rendering, to improve
smoothness.
There are two parameters you can tune to adjust the performance. ``repaint_delay``
and ``input_delay``. These control the artificial delays introduced into the
render loop to reduce CPU usage. See the link:kitty/kitty.conf[config file] for details.
2018-02-20 07:08:00 +03:00
See also the ``sync_to_monitor`` option to further decrease latency at the cost
of some link:https://en.wikipedia.org/wiki/Screen_tearing[tearing] while scrolling.
2017-08-26 07:54:12 +03:00
You can generate detailed per-function performance data using
2018-01-26 19:05:48 +03:00
link:https://github.com/gperftools/gperftools[gperftools]. Build kitty with
`make profile` which will create an executable called `kitty-profile`. Run
2017-12-20 06:20:09 +03:00
that and perform the task you want to analyse, for example, scrolling a large
2017-08-26 07:54:12 +03:00
file with `less`. After you quit, function call statistics will be printed to
`stdout` and you can use tools like *kcachegrind* for more detailed analysis.
2017-10-10 06:51:42 +03:00
Here are some CPU usage numbers for the task of scrolling a file continuously in less.
The CPU usage is for the terminal process and X together and is measured using htop.
2017-12-20 06:20:09 +03:00
The measurements are taken at the same font and window size for all terminals on a
`Intel(R) Core(TM) i7-4820K CPU @ 3.70GHz` CPU with a
2017-10-10 06:51:42 +03:00
`Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde XT [Radeon HD 7770/8760 / R7 250X]` GPU.
|===
| Terminal | CPU usage (X + terminal)
| kitty | 6 - 8%
| xterm | 5 - 7% (but scrolling was extremely janky)
| termite | 10 - 13%
| urxvt | 12 - 14%
| gnome-terminal | 15 - 17%
| konsole | 29 - 31%
|===
As you can see, kitty uses much less CPU than all terminals, except xterm, but
its scrolling "smoothness" is much better than that of xterm (at least to my,
admittedly biased, eyes).
2017-01-18 18:55:35 +03:00
== Note for Linux/macOS packagers
2017-01-08 09:47:44 +03:00
While kitty does use python, it is not a traditional python package, so please do not install it in site-packages.
Instead run,
```
python3 setup.py linux-package
```
2017-01-09 08:07:10 +03:00
This will install kitty into the directory `linux-package`. You can run kitty
with `linux-package/bin/kitty`. All the files needed to run kitty will be in
`linux-package/lib/kitty`. The terminfo file will be installed into
`linux-package/share/terminfo`. Simply copy these files into `/usr` to install
kitty. In other words, `linux-package` is the staging area into which kitty is
installed. You can choose a different staging area, by passing the `--prefix`
argument to `setup.py`.
You should probably split kitty into two packages, `kitty-terminfo` that
installs the terminfo file and `kitty` that installs the main program.
This allows users to install the terminfo file on servers into which they ssh,
without needing to install all of kitty.
2017-01-08 09:47:44 +03:00
2018-03-21 18:42:44 +03:00
You also need `tic` to compile the terminfo files, it is usually found in the development package of `ncurses`
2017-01-18 18:56:48 +03:00
This applies to creating packages for kitty for macOS package managers such as
2017-01-12 09:28:11 +03:00
brew or MacPorts as well.
2017-12-09 08:23:13 +03:00
== Frequently Asked Questions
=== Some special symbols are rendered small/truncated in kitty?
2018-02-04 18:32:30 +03:00
The number of cells a unicode character takes up are controlled by the unicode
standard. All characters are rendered in a single cell unless the unicode
standard says they should be rendered in two cells. When a symbol does not fit,
it will either be rescaled to be smaller or truncated (depending on how much
extra space it needs). This is often different from other terminals which just
let the character overflow into neighboring cells, which is fine if the
neighboring cell is empty, but looks terrible if it is not.
Some programs, like powerline, vim with fancy gutter symbols/status-bar, etc.
2018-03-09 08:30:50 +03:00
misuse unicode characters from the private use area to represent symbols. Often
2018-02-04 18:32:30 +03:00
these symbols are square and should be rendered in two cells. However, since
private use area symbols all have their width set to one in the unicode
2018-03-09 08:30:50 +03:00
standard, kitty renders them either smaller or truncated. The exception is if
these characters are followed by a space or empty cell in which case kitty
makes use of the extra cell to render them in two cells.
2017-12-09 08:23:13 +03:00
2017-12-12 07:19:41 +03:00
=== How do I build kitty.app on macOS?
2018-03-18 12:56:40 +03:00
Install `imagemagick`, `optipng` and `librsvg` using `brew` or similar (needed for the logo generation step).
2018-01-11 18:52:10 +03:00
And run:
2017-12-12 07:19:41 +03:00
```
2018-01-19 08:12:12 +03:00
make app
2017-12-16 06:59:19 +03:00
```
2017-12-12 07:19:41 +03:00
2018-01-11 06:10:35 +03:00
This `kitty.app` unlike the released one does not include its own copy of
python and the other dependencies. So if you ever un-install/upgrade those dependencies
you might have to rebuild the app.
2018-01-10 05:14:16 +03:00
Note that the released kitty.dmg includes all dependencies, unlike the
`kitty.app` built above and is built automatically by using the `kitty` branch of
2017-12-12 07:19:41 +03:00
link:https://github.com/kovidgoyal/build-calibre[build-calibre] however, that
2018-01-10 05:14:16 +03:00
is designed to run on Linux and is not for the faint of heart.
2017-12-12 07:19:41 +03:00
2018-02-06 06:25:42 +03:00
=== Using a color theme with a background color does not work well in vim?
First make sure you have not changed the TERM environment variable, it should
be `xterm-kitty`. vim uses *background color erase* even if the terminfo file
does not contain the `bce` capability. This is a bug in vim. You can work around
it by adding the following to your vimrc:
....
let &t_ut=''
....
See link:https://github.com/kovidgoyal/kitty/blob/master/protocol-extensions.asciidoc#setting-text-styles-colors-in-arbitrary-regions-of-the-screen[here]
for why kitty does not support background color erase.
2018-03-11 20:01:19 +03:00
=== I get errors about the terminal being unknown or opening the terminal failing when SSHing into a different computer?
2018-02-12 07:49:12 +03:00
2018-03-09 08:30:50 +03:00
This happens because the kitty terminfo files are not available on the server.
Either install kitty on the server, or simply copy over the terminfo files,
using:
2018-02-12 07:49:12 +03:00
....
2018-04-09 14:15:11 +03:00
infocmp xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin
2018-02-12 07:49:12 +03:00
....
2018-03-09 08:30:50 +03:00
Really, the correct solution for this is to convince the OpenSSH maintainers to
have ssh do this automatically when connecting to a server, so that all
terminals work transparently.
2018-02-12 07:49:12 +03:00
2018-05-03 07:10:18 +03:00
In the meantime, you can automate it by using a simple script called, for example,
`~/bin/myssh`
....
#!/bin/sh
infocmp xterm-kitty | ssh $1 tic -x -o \~/.terminfo /dev/stdin && ssh $1
....
Then you can use `myssh server` to log in to `server` with the terminfo file
being automatically available.
2018-03-15 18:27:08 +03:00
2018-04-02 08:15:52 +03:00
=== How do I change the colors in a running kitty instance?
You can either use the
link:http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands[OSC
terminal escape codes] to set colors or you can enable link:remote-control.asciidoc[remote control]
for kitty and use `kitty @ set-colors --help`.
2018-03-15 18:27:08 +03:00
=== How do I specify command line options for kitty on macOS?
Apple does not want you to use command line options with GUI applications. To
workaround that limitation, kitty will read command line options from the file
2018-04-06 05:46:14 +03:00
`<kitty config dir>/macos-launch-services-cmdline` when it is launched
2018-03-15 18:27:08 +03:00
from the GUI, i.e. by clicking the kitty application icon or using `open -a kitty`.
2018-03-15 18:28:26 +03:00
Note that this file is *only read* when running via the GUI.
2018-03-15 18:27:08 +03:00
You can, of course, also run kitty from a terminal with command line options, using:
`/Applications/kitty.app/Contents/MacOS/kitty`.
And within kitty itself, you can always run kitty using just `kitty` as it
cleverly adds itself to the PATH.
2018-05-21 06:36:19 +03:00
=== kitty is not able to use my favorite font?
kitty achieves its stellar performance by caching alpha masks of each rendered
character on the GPU, so that every character needs to be rendered only once.
This means it is a strictly character cell based display. As such it can use
only monospace fonts, since every cell in the grid has to be the same size. If
your font is not listed in `kitty list-fonts` it means that it is not
monospace. On Linux you can list all monospace fonts with,
```
fc-list : family spacing | grep spacing=100
```
2016-12-08 07:18:58 +03:00
== Resources on terminal behavior
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
https://en.wikipedia.org/wiki/C0_and_C1_control_codes
2018-02-14 14:38:09 +03:00
https://vt100.net/