about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2021-05-30 22:35:17 +0200
committerJörg Thalheim <joerg@thalheim.io>2021-05-30 23:14:05 +0200
commita5a0dd6c919a2b4f12ef2b4f57a0d9a2a9cabf34 (patch)
treeb1ec0684d776abb798f644eb04b2c5a1797ad107
parent69e3cebf26dc5c6a9c13fe3269bcd659060d7c4e (diff)
downloadprofani-tty-a5a0dd6c919a2b4f12ef2b4f57a0d9a2a9cabf34.tar.gz
external editor: don't use absolute paths and allow path search
-rw-r--r--src/command/cmd_funcs.c6
-rw-r--r--src/config/preferences.c2
2 files changed, 2 insertions, 6 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index b2262c5f..a56f0cfc 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -9418,15 +9418,11 @@ cmd_editor(ProfWin* window, const char* const command, gchar** args)
     g_object_unref(fos);
 
     char* editor = prefs_get_string(PREF_COMPOSE_EDITOR);
-    if (!g_file_test(editor, G_FILE_TEST_EXISTS)) {
-        cons_show_error("Editor: binary %s not exist", editor);
-        return TRUE;
-    }
 
     // Fork / exec
     pid_t pid = fork();
     if (pid == 0) {
-        int x = execl(editor, editor, g_file_get_path(file), (char*)NULL);
+        int x = execlp(editor, editor, g_file_get_path(file), (char*)NULL);
         if (x == -1) {
             cons_show_error("Editor:Failed to exec %s", editor);
         }
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 4ff51092..c930fccd 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -2340,7 +2340,7 @@ _get_default_string(preference_t pref)
     case PREF_URL_OPEN_CMD:
         return "xdg-open %u";
     case PREF_COMPOSE_EDITOR:
-        return "/usr/bin/vim";
+        return "vim";
     case PREF_URL_SAVE_CMD:
         return NULL; // Default to built-in method.
     default: