summaryrefslogtreecommitdiffstats
path: root/beets/util/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'beets/util/__init__.py')
-rw-r--r--beets/util/__init__.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/beets/util/__init__.py b/beets/util/__init__.py
index 00558e90a..ccb95b459 100644
--- a/beets/util/__init__.py
+++ b/beets/util/__init__.py
@@ -978,14 +978,14 @@ def open_anything() -> str:
def editor_command() -> str:
"""Get a command for opening a text file.
- Use the `EDITOR` environment variable by default. If it is not
- present, fall back to `open_anything()`, the platform-specific tool
- for opening files in general.
+ First try environment variable `VISUAL` followed by `EDITOR`. As last resort
+ fall back to `open_anything()`, the platform-specific tool for opening files
+ in general.
+
"""
- editor = os.environ.get("EDITOR")
- if editor:
- return editor
- return open_anything()
+ return (
+ os.environ.get("VISUAL") or os.environ.get("EDITOR") or open_anything()
+ )
def interactive_open(targets: Sequence[str], command: str):