Also clear the input after successful sourcing of a file.
 /**
  * Run all ex commands in a file.
  */
-gboolean ex_run_file(const char *filename)
+VbCmdResult ex_run_file(const char *filename)
 {
     char *line, **lines;
+    VbCmdResult res = VB_CMD_SUCCESS;
 
     lines = util_get_lines(filename);
 
     if (!lines) {
-        return false;
+        return res;
     }
 
     int length = g_strv_length(lines) - 1;
     for (int i = 0; i < length; i++) {
         line = lines[i];
-        if (*line == '#') {
+        /* skip commented or empty lines */
+        if (*line == '#' || !*line) {
             continue;
         }
-        if (ex_run_string(line, false) & VB_CMD_ERROR) {
+        if ((ex_run_string(line, false) & ~VB_CMD_KEEPINPUT) == VB_CMD_ERROR) {
+            res = VB_CMD_ERROR | VB_CMD_KEEPINPUT;
             g_warning("Invalid command in %s: '%s'", filename, line);
         }
     }
     g_strfreev(lines);
 
-    return true;
+    return res;
 }
 
 /**
 
 static VbCmdResult ex_source(const ExArg *arg)
 {
-    return ex_run_file(arg->rhs->str) ? VB_CMD_SUCCESS | VB_CMD_KEEPINPUT : VB_CMD_ERROR;
+    return ex_run_file(arg->rhs->str);
 }
 
 static VbCmdResult ex_handlers(const ExArg *arg)
 
 void ex_input_changed(const char *text);
 gboolean ex_fill_completion(GtkListStore *store, const char *input);
 VbCmdResult ex_run_string(const char *input, gboolean enable_history);
-gboolean ex_run_file(const char *filename);
+VbCmdResult ex_run_file(const char *filename);
 
 #endif /* end of include guard: _EX_H */
 
 static void set_title(const char *title);
 static void init_core(void);
 static void marks_clear(void);
-static void read_config(void);
 static void setup_signals();
 static void init_files(void);
 static void session_init(void);
     /* make sure the main window and all its contents are visible */
     gtk_widget_show_all(gui->window);
 
-    read_config();
+    /* read the config file */
+    ex_run_file(vb.files[FILES_CONFIG]);
 
     /* initially apply input style */
     vb_update_input_style();
     }
 }
 
-static void read_config(void)
-{
-    ex_run_file(vb.files[FILES_CONFIG]);
-}
-
 static void setup_signals()
 {
     /* Set up callbacks so that if either the main window or the browser