From 0051a7cb259f2b88e01b9efe92580aafc970fbe4 Mon Sep 17 00:00:00 2001 From: Scott Prager Date: Fri, 10 Oct 2014 21:51:25 -0400 Subject: vim-patch:7.4.414 Problem: Cannot define a command only when it's used. Solution: Add the CmdUndefined autocommand event. (partly by Yasuhiro Matsumoto) https://code.google.com/p/vim/source/detail?r=v7-4-414 --- src/nvim/ex_docmd.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/nvim/ex_docmd.c') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 67c346237c..7e0122acd2 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1459,6 +1459,24 @@ static char_u * do_one_cmd(char_u **cmdlinep, /* Find the command and let "p" point to after it. */ p = find_command(&ea, NULL); + // If this looks like an undefined user command and there are CmdUndefined + // autocommands defined, trigger the matching autocommands. + if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip + && ASCII_ISUPPER(*ea.cmd) + && has_cmdundefined()) { + char_u *p = ea.cmd; + + while (ASCII_ISALNUM(*p)) { + ++p; + } + p = vim_strnsave(ea.cmd, p - ea.cmd); + int ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL); + free(p); + if (ret && !aborting()) { + p = find_command(&ea, NULL); + } + } + if (p == NULL) { if (!ea.skip) errormsg = (char_u *)_("E464: Ambiguous use of user-defined command"); -- cgit From bffea01c89bfe2c93169f65b50653d63dcb8e035 Mon Sep 17 00:00:00 2001 From: Scott Prager Date: Fri, 10 Oct 2014 22:05:42 -0400 Subject: vim-patch:7.4.415 Problem: Cannot build. Warning for shadowed variable. (John Little) Solution: Add missing change. Remove declaration. https://code.google.com/p/vim/source/detail?name=v7-4-414&r=20dbceb6f4713ccd01be45dc531abc269fbb7579 --- src/nvim/ex_docmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/nvim/ex_docmd.c') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 7e0122acd2..134def0c2c 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1464,8 +1464,7 @@ static char_u * do_one_cmd(char_u **cmdlinep, if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip && ASCII_ISUPPER(*ea.cmd) && has_cmdundefined()) { - char_u *p = ea.cmd; - + p = ea.cmd; while (ASCII_ISALNUM(*p)) { ++p; } -- cgit