diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2024-11-17 17:06:10 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2024-11-17 17:17:43 +1300 |
commit | bfca5455dde533d037ae704d857b90bb46df481a (patch) | |
tree | 37d5cc2cdcd0e3bc1204bc04781dfd4ce76bdd3b | |
parent | Bail out if the editor process exits non-zero (diff) | |
download | vixf-bfca5455dde533d037ae704d857b90bb46df481a.tar.gz vixf-bfca5455dde533d037ae704d857b90bb46df481a.zip |
Simplify/clarify editor selection logic
pylint is upset about this because it thinks it's a module-level
constant, but we'll be fixing that soon.
Do away with the dedicated environment variable, too; better to do this
with command-line arguments or a config file, I think.
-rw-r--r-- | vixf.py3 | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -40,13 +40,13 @@ with tempfile.NamedTemporaryFile(mode='w', delete_on_close=False) as tf: tf.write(pyperclip.paste()) tf.close() - editor = EDITOR - env = os.environ - for key in ['VIXF_EDITOR', 'VISUAL', 'EDITOR']: - if key in env: - editor = env[key] - break + if 'VISUAL' in env: + editor = env['VISUAL'] + elif 'EDITOR' in env: + editor = env['EDITOR'] + else: + editor = EDITOR command = [ 'x-terminal-emulator', |