Kitty: Difference between revisions
Jump to navigation
Jump to search
(2 intermediate revisions by the same user not shown) | |||
Line 55: | Line 55: | ||
# Create a new window splitting the space used by the existing one so that |
# Create a new window splitting the space used by the existing one so that |
||
# the two windows are placed one above the other |
# the two windows are placed one above the other |
||
map ctrl+shift+o launch --location=hsplit |
map ctrl+shift+o launch --location=hsplit --cwd=current |
||
# Create a new window splitting the space used by the existing one so that |
# Create a new window splitting the space used by the existing one so that |
||
# the two windows are placed side by side |
# the two windows are placed side by side |
||
map ctrl+shift+e launch --location=vsplit |
map ctrl+shift+e launch --location=vsplit --cwd=current |
||
# Create a new window splitting the space used by the existing one so that |
# Create a new window splitting the space used by the existing one so that |
||
Line 109: | Line 109: | ||
kitty -c NONE -o font_size=12 -o allow_remote_control=yes # Or through config |
kitty -c NONE -o font_size=12 -o allow_remote_control=yes # Or through config |
||
kitty @ set-font-size -- +2 |
kitty @ set-font-size -- +2 |
||
</source> |
|||
=== Example startup script === |
|||
An example script to create a 4-window kitty, launching dedicating command in some windows: |
|||
<source lang="bash"> |
|||
#! /bin/bash |
|||
# |
|||
# Usage: kitty ./layout.sh |
|||
function kitty-resize-window() |
|||
{ |
|||
WINDOW=$1 |
|||
AXIS=$2 |
|||
SIZE=$3 |
|||
case $AXIS in |
|||
vertical) |
|||
QUERY=lines ;; |
|||
horizontal) |
|||
QUERY=columns ;; |
|||
esac |
|||
while true; do |
|||
LINES=$(kitty @ ls | jq ".[].tabs[].windows[] | select( .title == \"$WINDOW\" ) | .$QUERY") |
|||
DELTA=$((SIZE - LINES)) |
|||
[ $DELTA -ge -1 -a $DELTA -le 1 ] && break |
|||
kitty @ resize-window --match title:$WINDOW --increment $DELTA --axis $AXIS |
|||
done |
|||
} |
|||
kitty @ launch --type tab --title "editor" --tab-title "first" |
|||
kitty @ launch --match title:first --location vsplit --title "python" ./dev.sh |
|||
kitty @ launch --match title:first --location hsplit --title "remote_bash" |
|||
kitty @ focus-window --match title:editor |
|||
kitty @ launch --match title:first --location hsplit --title "local_bash" |
|||
kitty-resize-window local_bash vertical 10 |
|||
kitty-resize-window python horizontal 60 |
|||
kitty @ focus-window --match title:editor |
|||
kitty @ send-text --match title:editor "vim myscript.py\n" |
|||
</source> |
</source> |
Latest revision as of 11:53, 26 July 2023
A cross-platform, fast, feature-rich, GPU based terminal, with support for hyperlinks, image viewer.
References
Install / config
- See also Kitty FAQ
- Setup terminfo
# SSH locally so that kitty will install terminfo file automatically (in ~/.terminfo/kitty.terminfo)
kitty +kitten ssh localhost
# Can also copy the file manually:
# See https://sw.kovidgoyal.net/kitty/kittens/ssh/#manual-terminfo-copy
infocmp -a xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin
- Add
xterm-kitty
to ~/.dircolors.cfg
TERM xterm-color
TERM xterm-debian
+TERM xterm-kitty
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
- Configure font thickness in white themes, .config/kitty/kitty.conf:
# See kitty.conf help text or https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.text_composition_strategy on how to setup this variable
# See https://github.com/kovidgoyal/kitty/issues/6197
# See background tech details at: https://github.com/kovidgoyal/kitty/pull/5969
# This setting gives pixel identical rendering as gnome-terminator with light themes
text_composition_strategy 1.6 0
- Add font resize shortcut:
# See https://sw.kovidgoyal.net/kitty/conf/#conf-kitty-shortcuts-layout
# Resize fonts in current OS window
map ctrl+shift+equal change_font_size current +1.0
map ctrl+shift+plus change_font_size current +1.0
map ctrl+shift+kp_add change_font_size current +1.0
map ctrl+minus change_font_size current -1.0
map ctrl+shift+kp_subtract change_font_size current -1.0
# map ctrl+shift+backspace change_font_size current 0
map ctrl+0 change_font_size current 0
- Add window splitting / zooming:
enabled_layouts splits:split_axis=horizontal, stack
# Create a new window splitting the space used by the existing one so that
# the two windows are placed one above the other
map ctrl+shift+o launch --location=hsplit --cwd=current
# Create a new window splitting the space used by the existing one so that
# the two windows are placed side by side
map ctrl+shift+e launch --location=vsplit --cwd=current
# Create a new window splitting the space used by the existing one so that
# the two windows are placed side by side if the existing window is wide or
# one above the other if the existing window is tall.
# map f4 launch --location=split
# Rotate the current split, changing its split axis from vertical to
# horizontal or vice versa
# map f7 layout_action rotate
# Move the active window in the indicated direction
# map shift+up move_window up
# map shift+left move_window left
# map shift+right move_window right
# map shift+down move_window down
# Move the active window to the indicated screen edge
# map ctrl+shift+up layout_action move_to_screen_edge top
# map ctrl+shift+left layout_action move_to_screen_edge left
# map ctrl+shift+right layout_action move_to_screen_edge right
# map ctrl+shift+down layout_action move_to_screen_edge bottom
# Switch focus to the neighboring window in the indicated direction
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
# Note: use ctrl-shift-r to resize the current window
# Zoom on current window
map ctrl+shift+z toggle_layout stack
- Setup midnight commander, add to ~/.config/mc/ini:
[terminal:xterm-kitty]
up=\ek
down=\ej
left=\eh
right=\el
Tips
Increase font size
Increasing the font size dynamically seems to require to enable remote control
kitty -c NONE -o font_size=12 -o allow_remote_control=yes # Or through config
kitty @ set-font-size -- +2
Example startup script
An example script to create a 4-window kitty, launching dedicating command in some windows:
#! /bin/bash
#
# Usage: kitty ./layout.sh
function kitty-resize-window()
{
WINDOW=$1
AXIS=$2
SIZE=$3
case $AXIS in
vertical)
QUERY=lines ;;
horizontal)
QUERY=columns ;;
esac
while true; do
LINES=$(kitty @ ls | jq ".[].tabs[].windows[] | select( .title == \"$WINDOW\" ) | .$QUERY")
DELTA=$((SIZE - LINES))
[ $DELTA -ge -1 -a $DELTA -le 1 ] && break
kitty @ resize-window --match title:$WINDOW --increment $DELTA --axis $AXIS
done
}
kitty @ launch --type tab --title "editor" --tab-title "first"
kitty @ launch --match title:first --location vsplit --title "python" ./dev.sh
kitty @ launch --match title:first --location hsplit --title "remote_bash"
kitty @ focus-window --match title:editor
kitty @ launch --match title:first --location hsplit --title "local_bash"
kitty-resize-window local_bash vertical 10
kitty-resize-window python horizontal 60
kitty @ focus-window --match title:editor
kitty @ send-text --match title:editor "vim myscript.py\n"