From 0d558655452a04bd4fd0dcdcb418d03686edafbd Mon Sep 17 00:00:00 2001 From: egnor Date: Wed, 28 Jul 2021 23:41:47 -0700 Subject: [PATCH 1/3] more accurately describe editor behavior --- docs/glossary.rst | 10 ++++++++++ docs/kittens/remote_file.rst | 7 ++++--- kitty/options/definition.py | 14 +++++++------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/docs/glossary.rst b/docs/glossary.rst index 118117ac1..4d46bc182 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -52,6 +52,16 @@ Variables that influence kitty behavior files. Defaults to :file:`~/.config/kitty`. For full details of the config directory lookup mechanism see, :option:`kitty --config`. +.. envvar:: EDITOR + + The terminal editor (such as `vi` or `nano`) for editing config files. + Overridden by :envvar:`VISUAL`. + +.. envvar:: VISUAL + + The terminal editor (such as `vi` or `nano`) for editing config files. + Takes precedence over :envvar:`EDITOR`. + .. envvar:: VISUAL diff --git a/docs/kittens/remote_file.rst b/docs/kittens/remote_file.rst index 3c661a3a6..d7d3e4b30 100644 --- a/docs/kittens/remote_file.rst +++ b/docs/kittens/remote_file.rst @@ -17,9 +17,10 @@ Then hold down :kbd:`ctrl+shift` and click the name of the file. |kitty| will ask you what you want to do with the remote file. You can choose to *Edit* it in which case kitty will download it and open it locally in your -``EDITOR``. As you make changes to the file, they are automatically transferred -to the remote computer. Note that this happens without needing to install *any* -special software on the server, beyond ``ls`` that supports hyperlinks. +:envvar:`EDITOR`. As you make changes to the file, they are automatically +transferred to the remote computer. Note that this happens without needing +to install *any* special software on the server, beyond ``ls`` that supports +hyperlinks. .. versionadded:: 0.19.0 diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 953a0fb1c..facd72e63 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -2418,13 +2418,13 @@ starts in interactive mode and reads its startup rc files. opt('editor', '.', long_text=''' The console editor to use when editing the kitty config file or similar tasks. -The default value of ``.`` means to use the environment variables :envvar:`VISUAL` -and :envvar:`EDITOR` in that order. Note that these environment variables have -to be set when kitty starts, so if they're only set in shell startup scripts, but -kitty is launched directly from your desktop, kitty will not see them. kitty does try -to read the values from the shell as well, but this process is not entirely robust since -there are a myriad different shells out there. In that case you're better off naming -your favorite editor here. + +The default value of . means to use the environment variables :envvar:`VISUAL` +and :envvar:`EDITOR` in that order. If these variables aren't set, kitty will +run your shell (`$SHELL -l -c env`) to see if your shell config files set +:envvar:`VISUAL` or :envvar:`EDITOR`. If that doesn't work, kitty will cycle +through various known editors (`vim`, `emacs`, etc) and take the first one +that exists on your system. ''' ) From 96ce6c9504bd644797a7c25b228046d68fdb1981 Mon Sep 17 00:00:00 2001 From: egnor Date: Wed, 28 Jul 2021 23:47:55 -0700 Subject: [PATCH 2/3] Resolve some duplication in glossary.rst --- docs/glossary.rst | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/docs/glossary.rst b/docs/glossary.rst index 4d46bc182..93dc71a3b 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -52,21 +52,11 @@ Variables that influence kitty behavior files. Defaults to :file:`~/.config/kitty`. For full details of the config directory lookup mechanism see, :option:`kitty --config`. -.. envvar:: EDITOR - - The terminal editor (such as `vi` or `nano`) for editing config files. - Overridden by :envvar:`VISUAL`. .. envvar:: VISUAL - The terminal editor (such as `vi` or `nano`) for editing config files. - Takes precedence over :envvar:`EDITOR`. - - -.. envvar:: VISUAL - - Controls what program kitty uses as an editor, when, for instance, opening - kitty.conf in response to :sc:`edit_config_file` + The terminal editor (such as ``vi`` or ``nano``) kitty uses, when, for + instance, opening :file:`kitty.conf` in response to :sc:`edit_config_file`. .. envvar:: EDITOR From 8d5479f55e892d4ccfab1020ee2a2193c7580fe3 Mon Sep 17 00:00:00 2001 From: egnor Date: Wed, 28 Jul 2021 23:50:11 -0700 Subject: [PATCH 3/3] minor tweaks to wording and formatting --- kitty/options/definition.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kitty/options/definition.py b/kitty/options/definition.py index facd72e63..7f22a89be 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -2417,13 +2417,14 @@ starts in interactive mode and reads its startup rc files. opt('editor', '.', long_text=''' -The console editor to use when editing the kitty config file or similar tasks. +The terminal editor (such as ``vim`` or ``nano``) to use when editing the kitty +config file or similar tasks. The default value of . means to use the environment variables :envvar:`VISUAL` and :envvar:`EDITOR` in that order. If these variables aren't set, kitty will -run your shell (`$SHELL -l -c env`) to see if your shell config files set +run your shell (``$SHELL -l -c env``) to see if your shell config files set :envvar:`VISUAL` or :envvar:`EDITOR`. If that doesn't work, kitty will cycle -through various known editors (`vim`, `emacs`, etc) and take the first one +through various known editors (``vim``, ``emacs``, etc) and take the first one that exists on your system. ''' )