From c46f20073ad5349964bfa8e4c816b1c9068495d1 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Mon, 4 Nov 2013 20:00:45 +0100 Subject: [PATCH] Show error message if ex command is not known. --- src/ex.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ex.c b/src/ex.c index 14a463e..567b5c5 100644 --- 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; } -- 2.20.1