Skip to content

Commit dcf4fc7

Browse files
committed
Add an example of saving remote sessions to the docs
1 parent ba0cc0f commit dcf4fc7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/sessions.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,28 @@ mapping for it::
200200
The two can be combined, using the :ac:`combine` action.
201201

202202

203+
Sessions with remote connections
204+
-------------------------------------
205+
206+
If you use the :doc:`ssh kitten </kittens/ssh>` to connect to remote computers,
207+
:ac:`save_as_session` is smart enough to save the ssh kitten invocation to your
208+
session file, preserving the remote working directory and even the currently
209+
running program on the remote host! Try it, run kitty with::
210+
211+
kitty -o 'map f1 save_as_session --use-foreground-process --relocatable' --session <(echo "layout vertical\nlaunch\nlaunch")
212+
213+
Now in both windows, run::
214+
215+
kitten ssh localhost
216+
217+
To connect them both to a remote computer (replace ``localhost`` with another
218+
computer if you like). In one window change the directory to /tmp and in the
219+
other start some program. Then press :kbd:`F1` to save the session file.
220+
When you run the session file in another kitty instance you will see both
221+
windows re-created, as expected with the correct working directories and
222+
running programs.
223+
224+
203225
Keyword reference
204226
---------------------
205227

0 commit comments

Comments
 (0)