1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

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.
This commit is contained in:
Paul Fertser 2022-03-27 21:44:32 +03:00
parent 409268e2b6
commit 1272543237

View File

@ -2277,8 +2277,10 @@ _get_default_string(preference_t pref)
return "xdg-open"; return "xdg-open";
case PREF_URL_OPEN_CMD: case PREF_URL_OPEN_CMD:
return "xdg-open %u"; return "xdg-open %u";
case PREF_COMPOSE_EDITOR: case PREF_COMPOSE_EDITOR: {
return "vim"; gchar* editor = getenv("EDITOR");
return editor ? editor : "vim";
}
case PREF_URL_SAVE_CMD: case PREF_URL_SAVE_CMD:
return NULL; // Default to built-in method. return NULL; // Default to built-in method.
default: default: