diff src/ex_docmd.c @ 23938:2a885d095bff v8.2.2511

patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places Commit: https://github.com/vim/vim/commit/39f3b1411068ff187b4f9f482b2d6b2c1e7a7268 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 14 12:57:36 2021 +0100 patch 8.2.2511: Vim9: cannot use Vim9 script syntax in some places Problem: Vim9: cannot use Vim9 script syntax in some places. Solution: Add the :vim9cmd command modifier. Incompatible: Makes ":vim9" mean ":vim9cmd" instead of ":vim9script".
author Bram Moolenaar <Bram@vim.org>
date Sun, 14 Feb 2021 13:00:04 +0100
parents 00e904bdb8a5
children 6e593e0aaadf
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1737,7 +1737,7 @@ do_one_cmd(
     int		starts_with_colon = FALSE;
 #ifdef FEAT_EVAL
     int		may_have_range;
-    int		vim9script = in_vim9script();
+    int		vim9script;
     int		did_set_expr_line = FALSE;
 #endif
     int		sourcing = flags & DOCMD_VERBOSE;
@@ -1785,7 +1785,7 @@ do_one_cmd(
     if (parse_command_modifiers(&ea, &errormsg, &cmdmod, FALSE) == FAIL)
 	goto doend;
     apply_cmdmod(&cmdmod);
-
+    vim9script = in_vim9script();
     after_modifier = ea.cmd;
 
 #ifdef FEAT_EVAL
@@ -2933,6 +2933,17 @@ parse_command_modifiers(
 			    cmod->cmod_split |= WSP_VERT;
 			    continue;
 			}
+			if (checkforcmd(&eap->cmd, "vim9cmd", 4))
+			{
+			    if (ends_excmd2(p, eap->cmd))
+			    {
+				*errormsg =
+				      _(e_vim9cmd_must_be_followed_by_command);
+				return FAIL;
+			    }
+			    cmod->cmod_flags |= CMOD_VIM9CMD;
+			    continue;
+			}
 			if (!checkforcmd(&p, "verbose", 4))
 			    break;
 			if (vim_isdigit(*eap->cmd))