More ssh kitten docs

This commit is contained in:
Kovid Goyal 2022-03-04 07:01:18 +05:30
parent f1ce8c0e8a
commit 1c0d254ec6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 45 additions and 6 deletions

View File

@ -54,6 +54,33 @@ quick example:
See below for full details on the syntax and options of :file:`ssh.conf`. See below for full details on the syntax and options of :file:`ssh.conf`.
A real world example
----------------------
Suppose you often SSH into a production server, and you would like to setup
your shell and editor there using your custom settings. However, other people
could SSH in as well and you don't want to clobber their settings. Here is how
this could be achieved using the ssh kitten with zsh and vim as the shell and
editor, respectively:
.. code-block:: conf
# Have these settings apply to servers in my organization
hostname *.my-organization.net
# Setup zsh to read its files from my-conf/zsh
env ZDOTDIR $HOME/my-conf/zsh
copy --dest my-conf/zsh/.zshrc .zshrc
copy --dest my-conf/zsh/.zshenv .zshenv
# If you use other zsh init files add them in a similar manner
# Setup vim to read its config from my-conf/vim
env VIMINIT $HOME/my-conf/vim/vimrc
env VIMRUNTIME $HOME/my-conf/vim
copy --dest my-conf/vim .vim
copy --dest my-conf/vim/vimrc .vimrc
.. include:: /generated/conf-kitten-ssh.rst .. include:: /generated/conf-kitten-ssh.rst

View File

@ -194,13 +194,27 @@ code used for each shell below:
</details> </details>
Shell integration over SSH
----------------------------
The easiest way to have shell integration work when SSHing into remote systems
is to use the :doc:`ssh kitten <kittens/ssh>`. Simply run::
kitty +kitten ssh hostname
And, by magic, you will be logged into the remote system with fully functional
shell integration. Alternately, you can :ref:`setup shell integration manually
<manual_shell_integration>`, by copying the kitty shell integration scripts to
the remote server and editing the shell rc files there, as described below.
.. _manual_shell_integration: .. _manual_shell_integration:
Manual shell integration Manual shell integration
---------------------------- ----------------------------
The automatic shell integration is designed to be minimally intrusive, as such The automatic shell integration is designed to be minimally intrusive, as such
it wont work for sub-shells, terminal multiplexers, containers, remote systems, etc. it wont work for sub-shells, terminal multiplexers, containers, etc.
For such systems, you should setup manual shell integration by adding some code For such systems, you should setup manual shell integration by adding some code
to your shells startup files to load the shell integration script. to your shells startup files to load the shell integration script.
@ -248,11 +262,9 @@ The value of :envvar:`KITTY_SHELL_INTEGRATION` is the same as that for
completely, in which case simply do not set the completely, in which case simply do not set the
:envvar:`KITTY_SHELL_INTEGRATION` variable at all. :envvar:`KITTY_SHELL_INTEGRATION` variable at all.
If you want this to work while SSHing into a remote system, then you will In a container, you will need to install the kitty shell integration scripts
need to add some code to the snippets above to check if :envvar:`KITTY_INSTALLATION_DIR` and make sure the :envvar:`KITTY_INSTALLATION_DIR` environment variable is set
is empty and if so to set it to some hard coded location with the shell to point to the location of the scripts.
integration scripts that need to be copied onto the remote system.
Integration with other shells Integration with other shells
------------------------------- -------------------------------