diff options
author | Paul Fertser <fercerpav@gmail.com> | 2022-03-27 21:44:32 +0300 |
---|---|---|
committer | Paul Fertser <fercerpav@gmail.com> | 2022-03-27 21:48:45 +0300 |
commit | 127254323758e36fb9f10c796908f37cdc127537 (patch) | |
tree | 3dd1c53c63c68e6015f9e6a9468060e69578a3f1 /src/config | |
parent | 409268e2b6644b583a0e0c42648bb16d0cf6b3eb (diff) | |
download | profani-tty-127254323758e36fb9f10c796908f37cdc127537.tar.gz |
Use EDITOR environment variable
When preferences do not specify a program to be used for /editor command, try getting it from EDITOR (which POSIX.1-2017 calls one of "variables that are frequently exported by widely used command interpreters and applications"), fall back to "vim" if not set.
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/preferences.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c index 63d665f6..358c5fbf 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -2277,8 +2277,10 @@ _get_default_string(preference_t pref) return "xdg-open"; case PREF_URL_OPEN_CMD: return "xdg-open %u"; - case PREF_COMPOSE_EDITOR: - return "vim"; + case PREF_COMPOSE_EDITOR: { + gchar* editor = getenv("EDITOR"); + return editor ? editor : "vim"; + } case PREF_URL_SAVE_CMD: return NULL; // Default to built-in method. default: |