diff --git a/docs/glossary.rst b/docs/glossary.rst index da0304a4e..f0179fbcf 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -116,6 +116,11 @@ Variables that kitty sets when running child programs Path to a directory containing the kitty terminfo database. +.. envvar:: KITTY_INSTALLATION_DIR + + Path to the kitty installation directory. + + .. envvar:: COLORTERM Set to the value ``truecolor`` to indicate that kitty supports 16 million @@ -152,4 +157,5 @@ Variables that kitty sets when running child programs .. envvar:: KITTY_SHELL_INTEGRATION - Set when enabling :ref:`shell_integration`. + Set when enabling :ref:`shell_integration`. It is automatically removed by + the shell integration scripts. diff --git a/docs/shell-integration.rst b/docs/shell-integration.rst index 134240227..ea0a2297e 100644 --- a/docs/shell-integration.rst +++ b/docs/shell-integration.rst @@ -140,31 +140,29 @@ want to setup shell integration for a remote system over SSH, in Then in your shell's rc file, add the lines: -.. tab:: bash/zsh +.. tab:: bash .. code-block:: sh export KITTY_SHELL_INTEGRATION="enabled" - source $(kitty +runpy "from kitty.shell_integration import script_path; print(script_path())") + source "$KITTY_INSTALLATION_DIR/shell-integration/kitty.bash" + +.. tab:: zsh + + .. code-block:: sh + + export KITTY_SHELL_INTEGRATION="enabled" + source "$KITTY_INSTALLATION_DIR/shell-integration/kitty.zsh" .. tab:: fish .. code-block:: fish set --global KITTY_SHELL_INTEGRATION enabled - set --path --local kitty_paths (kitty +runpy 'from kitty.shell_integration import print_fish_paths; print_fish_paths()') - source kitty_paths[2] - set --prepend fish_complete_path kitty_paths[1] - set --erase kitty_paths + source "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish" + set --prepend fish_complete_path "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_completions.d" -You can get the path to the directory containing the various shell integration -scripts by looking at the directory displayed by: - -.. code-block:: sh - - kitty +runpy "from kitty.constants import *; print(shell_integration_dir)" - The value of :envvar:`KITTY_SHELL_INTEGRATION` is the same as that for :opt:`shell_integration`, except if you want to disable shell integration completely, in which case simply do not set the diff --git a/kitty/child.py b/kitty/child.py index 4948ac40d..4b8131d40 100644 --- a/kitty/child.py +++ b/kitty/child.py @@ -12,7 +12,7 @@ from typing import ( import kitty.fast_data_types as fast_data_types -from .constants import is_macos, shell_path, terminfo_dir +from .constants import is_macos, kitty_base_dir, shell_path, terminfo_dir from .types import run_once try: @@ -229,6 +229,7 @@ class Child: tdir = checked_terminfo_dir() if tdir: env['TERMINFO'] = tdir + env['KITTY_INSTALLATION_DIR'] = kitty_base_dir opts = fast_data_types.get_options() if opts.shell_integration != 'disabled': from .shell_integration import modify_shell_environ