From dcf4fc72f68469dbcc389b629cf22afdb69c0e17 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 22 Aug 2025 21:31:55 +0530 Subject: [PATCH] Add an example of saving remote sessions to the docs --- docs/sessions.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/sessions.rst b/docs/sessions.rst index 498fbf670..29a363d45 100644 --- a/docs/sessions.rst +++ b/docs/sessions.rst @@ -200,6 +200,28 @@ mapping for it:: The two can be combined, using the :ac:`combine` action. +Sessions with remote connections +------------------------------------- + +If you use the :doc:`ssh kitten ` to connect to remote computers, +:ac:`save_as_session` is smart enough to save the ssh kitten invocation to your +session file, preserving the remote working directory and even the currently +running program on the remote host! Try it, run kitty with:: + + kitty -o 'map f1 save_as_session --use-foreground-process --relocatable' --session <(echo "layout vertical\nlaunch\nlaunch") + +Now in both windows, run:: + + kitten ssh localhost + +To connect them both to a remote computer (replace ``localhost`` with another +computer if you like). In one window change the directory to /tmp and in the +other start some program. Then press :kbd:`F1` to save the session file. +When you run the session file in another kitty instance you will see both +windows re-created, as expected with the correct working directories and +running programs. + + Keyword reference ---------------------