Show error message if ex command is not known.
authorDaniel Carl <danielcarl@gmx.de>
Mon, 4 Nov 2013 19:00:45 +0000 (20:00 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Mon, 4 Nov 2013 19:01:56 +0000 (20:01 +0100)
src/ex.c

index 14a463e..567b5c5 100644 (file)
--- a/src/ex.c
+++ b/src/ex.c
@@ -506,7 +506,15 @@ static gboolean parse_command_name(const char **input, ExArg *arg)
     } while (matches > 0 && **input && **input != ' ' && **input != '!');
 
     if (!matches) {
-        /* TODO show readable error message */
+        /* read until next whitespace or end of input to get command name for
+         * error message - vim uses the whole rest of the input string - but
+         * the first word seems to bee enough for the error message */
+        for (; len < LENGTH(cmd) && *input && **input != ' '; (*input)++) {
+            cmd[len++] = **input;
+        }
+        cmd[len] = '\0';
+
+        vb_echo(VB_MSG_ERROR, true, "Unknown command: %s", cmd);
         return false;
     }