Add fallback to vim if $EDITOR env var is not set

This commit is contained in:
Paul Nameless 2020-05-19 14:52:58 +08:00
parent c439c77a44
commit f0ddbb2dbb

View file

@ -121,7 +121,7 @@ class Controller:
def write_long_msg(self):
file_path = "/tmp/tg-msg.txt"
with suspend(self.view) as s:
s.call(f"$EDITOR {file_path}")
s.call(f"$EDITOR {file_path} || vim {file_path}")
if not os.path.isfile(file_path):
return
with open(file_path) as f: