aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2024-11-17 17:06:10 +1300
committerTom Ryder <tom@sanctum.geek.nz>2024-11-17 17:17:43 +1300
commitbfca5455dde533d037ae704d857b90bb46df481a (patch)
tree37d5cc2cdcd0e3bc1204bc04781dfd4ce76bdd3b
parentBail out if the editor process exits non-zero (diff)
downloadvixf-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.py312
1 files changed, 6 insertions, 6 deletions
diff --git a/vixf.py3 b/vixf.py3
index 9a66b29..a2c171f 100644
--- a/vixf.py3
+++ b/vixf.py3
@@ -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',