Patch 8.2.2511
Problem:    Vim9: cannot use Vim9 script syntax in some places.
Solution:   Add the :vim9cmd command modifier. Incompatible: Makes ":vim9"
            mean ":vim9cmd" instead of ":vim9script".
Files:      runtime/doc/vim9.txt, runtime/doc/repeat.txt, src/ex_docmd.c,
            src/ex_cmds.h, src/structs.h, src/ex_cmdidxs.h, src/errors.h,
            src/testdir/test_vim9_cmd.vim, src/testdir/test_cmdline.vim,
            src/testdir/dumps/Test_wildmenu_1.dump,
            src/testdir/dumps/Test_wildmenu_2.dump,
            src/testdir/dumps/Test_wildmenu_3.dump,
            src/testdir/dumps/Test_wildmenu_4.dump,
            src/testdir/test_quickfix.vim


*** ../vim-8.2.2510/runtime/doc/vim9.txt        2021-02-03 17:41:19.924245848 
+0100
--- runtime/doc/vim9.txt        2021-02-13 21:54:10.629641406 +0100
***************
*** 51,56 ****
--- 51,57 ----
  - a function defined with the `:def` command
  - a script file where the first command is `vim9script`
  - an autocommand defined in the context of the above
+ - a command prefixed with the `vim9cmd` command modifier
  
  When using `:function` in a Vim9 script file the legacy syntax is used, with
  the highest |scriptversion|.  However, this can be confusing and is therefore
***************
*** 60,65 ****
--- 61,72 ----
  rewrite old scripts, they keep working as before.  You may want to use a few
  `:def` functions for code that needs to be fast.
  
+                                               *:vim9* *:vim9cmd*
+ :vim9[cmd] {cmd}
+               Execute {cmd} using Vim9 script syntax and semantics.
+               Useful when typing a command and in a legacy script or
+               function.
+ 
  ==============================================================================
  
  2. Differences from legacy Vim script                 *vim9-differences*
*** ../vim-8.2.2510/runtime/doc/repeat.txt      2021-01-31 17:02:06.258490157 
+0100
--- runtime/doc/repeat.txt      2021-02-13 22:31:32.364945106 +0100
***************
*** 354,366 ****
                        Vim version, or update Vim to a newer version.  See
                        |vimscript-version| for what changed between versions.
  
! :vim9[script] [noclear]                               *:vim9* *:vim9script*
                        Marks a script file as containing |Vim9-script|
                        commands.  Also see |vim9-namespace|.
                        Must be the first command in the file.
                        For [noclear] see |vim9-reload|.
                        Without the |+eval| feature this changes the syntax
                        for some commands.
                         
                                                *:scr* *:scriptnames*
  :scr[iptnames]                List all sourced script names, in the order 
they were
--- 354,368 ----
                        Vim version, or update Vim to a newer version.  See
                        |vimscript-version| for what changed between versions.
  
! :vim9s[cript] [noclear]                               *:vim9s* *:vim9script*
                        Marks a script file as containing |Vim9-script|
                        commands.  Also see |vim9-namespace|.
                        Must be the first command in the file.
                        For [noclear] see |vim9-reload|.
                        Without the |+eval| feature this changes the syntax
                        for some commands.
+                       See |:vim9cmd| for executing one command with Vim9
+                       syntax and semantics.
                         
                                                *:scr* *:scriptnames*
  :scr[iptnames]                List all sourced script names, in the order 
they were
*** ../vim-8.2.2510/src/ex_docmd.c      2021-02-07 16:40:02.246812677 +0100
--- src/ex_docmd.c      2021-02-13 22:23:37.678033427 +0100
***************
*** 1737,1743 ****
      int               starts_with_colon = FALSE;
  #ifdef FEAT_EVAL
      int               may_have_range;
!     int               vim9script = in_vim9script();
      int               did_set_expr_line = FALSE;
  #endif
      int               sourcing = flags & DOCMD_VERBOSE;
--- 1737,1743 ----
      int               starts_with_colon = FALSE;
  #ifdef FEAT_EVAL
      int               may_have_range;
!     int               vim9script;
      int               did_set_expr_line = FALSE;
  #endif
      int               sourcing = flags & DOCMD_VERBOSE;
***************
*** 1785,1791 ****
      if (parse_command_modifiers(&ea, &errormsg, &cmdmod, FALSE) == FAIL)
        goto doend;
      apply_cmdmod(&cmdmod);
! 
      after_modifier = ea.cmd;
  
  #ifdef FEAT_EVAL
--- 1785,1791 ----
      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,2938 ****
--- 2933,2949 ----
                            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))
*** ../vim-8.2.2510/src/ex_cmds.h       2021-01-24 12:53:30.780247041 +0100
--- src/ex_cmds.h       2021-02-13 22:04:28.248449234 +0100
***************
*** 1679,1684 ****
--- 1679,1687 ----
  EXCMD(CMD_vimgrepadd, "vimgrepadd",   ex_vimgrep,
        
EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK,
        ADDR_OTHER),
+ EXCMD(CMD_vim9cmd,    "vim9cmd",      ex_wrongmodifier,
+       EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN|EX_LOCK_OK,
+       ADDR_NONE),
  EXCMD(CMD_vim9script, "vim9script",   ex_vim9script,
        EX_WORD1|EX_CMDWIN|EX_LOCK_OK,
        ADDR_NONE),
*** ../vim-8.2.2510/src/structs.h       2021-02-11 21:19:30.518147953 +0100
--- src/structs.h       2021-02-13 21:50:16.186198935 +0100
***************
*** 642,647 ****
--- 642,648 ----
  #define CMOD_LOCKMARKS            0x0800      // ":lockmarks"
  #define CMOD_KEEPPATTERNS   0x1000    // ":keeppatterns"
  #define CMOD_NOSWAPFILE           0x2000      // ":noswapfile"
+ #define CMOD_VIM9CMD      0x4000      // ":vim9cmd"
  
      int               cmod_split;             // flags for win_split()
      int               cmod_tab;               // > 0 when ":tab" was used
*** ../vim-8.2.2510/src/ex_cmdidxs.h    2020-11-07 18:40:47.132725219 +0100
--- src/ex_cmdidxs.h    2021-02-13 22:09:36.279864681 +0100
***************
*** 27,36 ****
    /* t */ 458,
    /* u */ 503,
    /* v */ 514,
!   /* w */ 534,
!   /* x */ 548,
!   /* y */ 558,
!   /* z */ 559
  };
  
  /*
--- 27,36 ----
    /* t */ 458,
    /* u */ 503,
    /* v */ 514,
!   /* w */ 535,
!   /* x */ 549,
!   /* y */ 559,
!   /* z */ 560
  };
  
  /*
***************
*** 62,72 ****
    /* s */ {  2,  6, 15,  0, 19, 23,  0, 25, 26,  0,  0, 29, 31, 35, 39, 41,  
0, 50,  0, 51,  0, 63, 64,  0, 65,  0 },
    /* t */ {  2,  0, 19,  0, 24, 26,  0, 27,  0, 28,  0, 29, 33, 36, 38, 39,  
0, 40, 42,  0, 43,  0,  0,  0,  0,  0 },
    /* u */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  
0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
!   /* v */ {  1,  0,  0,  0,  2,  0,  0,  0,  5,  0,  0,  0, 11, 14,  0,  0,  
0,  0, 17,  0, 18,  0,  0,  0,  0,  0 },
    /* w */ {  2,  0,  0,  0,  0,  0,  0,  3,  4,  0,  0,  0,  0,  8,  0,  9, 
10,  0,  0,  0, 12, 13,  0,  0,  0,  0 },
    /* x */ {  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  5,  0,  0,  
0,  7,  0,  0,  8,  0,  0,  0,  0,  0 },
    /* y */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
    /* z */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
  };
  
! static const int command_count = 574;
--- 62,72 ----
    /* s */ {  2,  6, 15,  0, 19, 23,  0, 25, 26,  0,  0, 29, 31, 35, 39, 41,  
0, 50,  0, 51,  0, 63, 64,  0, 65,  0 },
    /* t */ {  2,  0, 19,  0, 24, 26,  0, 27,  0, 28,  0, 29, 33, 36, 38, 39,  
0, 40, 42,  0, 43,  0,  0,  0,  0,  0 },
    /* u */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  
0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
!   /* v */ {  1,  0,  0,  0,  2,  0,  0,  0,  5,  0,  0,  0, 12, 15,  0,  0,  
0,  0, 18,  0, 19,  0,  0,  0,  0,  0 },
    /* w */ {  2,  0,  0,  0,  0,  0,  0,  3,  4,  0,  0,  0,  0,  8,  0,  9, 
10,  0,  0,  0, 12, 13,  0,  0,  0,  0 },
    /* x */ {  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  5,  0,  0,  
0,  7,  0,  0,  8,  0,  0,  0,  0,  0 },
    /* y */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
    /* z */ {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
  };
  
! static const int command_count = 575;
*** ../vim-8.2.2510/src/errors.h        2021-02-11 21:19:30.518147953 +0100
--- src/errors.h        2021-02-13 22:16:39.390969519 +0100
***************
*** 363,365 ****
--- 363,367 ----
        INIT(= N_("E1162: Register name must be one character: %s"));
  EXTERN char e_variable_nr_type_mismatch_expected_str_but_got_str[]
        INIT(= N_("E1163: Variable %d: type mismatch, expected %s but got %s"));
+ EXTERN char e_vim9cmd_must_be_followed_by_command[]
+       INIT(= N_("E1164: vim9cmd must be followed by a command"));
*** ../vim-8.2.2510/src/testdir/test_vim9_cmd.vim       2021-02-02 
21:33:48.074488746 +0100
--- src/testdir/test_vim9_cmd.vim       2021-02-13 22:29:37.593209710 +0100
***************
*** 5,10 ****
--- 5,20 ----
  source term_util.vim
  source view_util.vim
  
+ def Test_vim9cmd()
+   var lines =<< trim END
+     vim9cmd var x = 123
+     let s:y = 'yes'
+     vim9c assert_equal(123, x)
+     vim9cm assert_equal('yes', y)
+   END
+   CheckScriptSuccess(lines)
+ enddef
+ 
  def Test_edit_wildcards()
    var filename = 'Xtest'
    edit `=filename`
*** ../vim-8.2.2510/src/testdir/test_cmdline.vim        2021-02-06 
12:38:47.623324174 +0100
--- src/testdir/test_cmdline.vim        2021-02-13 22:39:06.171208631 +0100
***************
*** 119,125 ****
    call term_sendkeys(buf, "\<Tab>")
    call VerifyScreenDump(buf, 'Test_wildmenu_3', {})
  
!   call term_sendkeys(buf, "\<Tab>")
    call VerifyScreenDump(buf, 'Test_wildmenu_4', {})
    call term_sendkeys(buf, "\<Esc>")
  
--- 119,125 ----
    call term_sendkeys(buf, "\<Tab>")
    call VerifyScreenDump(buf, 'Test_wildmenu_3', {})
  
!   call term_sendkeys(buf, "\<Tab>\<Tab>")
    call VerifyScreenDump(buf, 'Test_wildmenu_4', {})
    call term_sendkeys(buf, "\<Esc>")
  
*** ../vim-8.2.2510/src/testdir/dumps/Test_wildmenu_1.dump      2020-09-03 
16:49:49.721754552 +0200
--- src/testdir/dumps/Test_wildmenu_1.dump      2021-02-13 22:32:16.296843637 
+0100
***************
*** 4,8 ****
  |~| @73
  |~| @73
  |~| @73
! |v+0#0000001#ffff4012|i|m|9|s|c|r|i|p|t| +3#0000000#ffffff0@1|v|i|m|g|r|e|p| 
@1|v|i|m|g|r|e|p|a|d@1| @43
! |:+0&&|v|i|m|9|s|c|r|i|p|t> @63
--- 4,8 ----
  |~| @73
  |~| @73
  |~| @73
! |v+0#0000001#ffff4012|i|m|9|c|m|d| +3#0000000#ffffff0@1|v|i|m|9|s|c|r|i|p|t| 
@1|v|i|m|g|r|e|p| @1|v|i|m|g|r|e|p|a|d@1| @34
! |:+0&&|v|i|m|9|c|m|d> @66
*** ../vim-8.2.2510/src/testdir/dumps/Test_wildmenu_2.dump      2020-09-03 
16:49:49.721754552 +0200
--- src/testdir/dumps/Test_wildmenu_2.dump      2021-02-13 22:32:17.348841206 
+0100
***************
*** 4,8 ****
  |~| @73
  |~| @73
  |~| @73
! |v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v+0#0000001#ffff4012|i|m|g|r|e|p| 
+3#0000000#ffffff0@1|v|i|m|g|r|e|p|a|d@1| @43
! |:+0&&|v|i|m|g|r|e|p> @66
--- 4,8 ----
  |~| @73
  |~| @73
  |~| @73
! |v+3#0000000&|i|m|9|c|m|d| @1|v+0#0000001#ffff4012|i|m|9|s|c|r|i|p|t| 
+3#0000000#ffffff0@1|v|i|m|g|r|e|p| @1|v|i|m|g|r|e|p|a|d@1| @34
! |:+0&&|v|i|m|9|s|c|r|i|p|t> @63
*** ../vim-8.2.2510/src/testdir/dumps/Test_wildmenu_3.dump      2020-09-03 
16:49:49.721754552 +0200
--- src/testdir/dumps/Test_wildmenu_3.dump      2021-02-13 22:32:18.400838775 
+0100
***************
*** 4,8 ****
  |~| @73
  |~| @73
  |~| @73
! |v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v|i|m|g|r|e|p| 
@1|v+0#0000001#ffff4012|i|m|g|r|e|p|a|d@1| +3#0000000#ffffff0@43
! |:+0&&|v|i|m|g|r|e|p|a|d@1> @63
--- 4,8 ----
  |~| @73
  |~| @73
  |~| @73
! |v+3#0000000&|i|m|9|c|m|d| @1|v|i|m|9|s|c|r|i|p|t| 
@1|v+0#0000001#ffff4012|i|m|g|r|e|p| +3#0000000#ffffff0@1|v|i|m|g|r|e|p|a|d@1| 
@34
! |:+0&&|v|i|m|g|r|e|p> @66
*** ../vim-8.2.2510/src/testdir/dumps/Test_wildmenu_4.dump      2020-09-03 
16:49:49.721754552 +0200
--- src/testdir/dumps/Test_wildmenu_4.dump      2021-02-13 22:40:38.302871557 
+0100
***************
*** 4,8 ****
  |~| @73
  |~| @73
  |~| @73
! |v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v|i|m|g|r|e|p| @1|v|i|m|g|r|e|p|a|d@1| @43
  |:+0&&|v|i|m> @70
--- 4,8 ----
  |~| @73
  |~| @73
  |~| @73
! |v+3#0000000&|i|m|9|c|m|d| @1|v|i|m|9|s|c|r|i|p|t| @1|v|i|m|g|r|e|p| 
@1|v|i|m|g|r|e|p|a|d@1| @34
  |:+0&&|v|i|m> @70
*** ../vim-8.2.2510/src/testdir/test_quickfix.vim       2021-01-30 
18:09:02.723958488 +0100
--- src/testdir/test_quickfix.vim       2021-02-13 22:45:54.277810378 +0100
***************
*** 709,715 ****
    var dir = 'Xruntime/after'
    &rtp ..= ',' .. dir
    mkdir(dir .. '/ftplugin', 'p')
!   writefile(['vim9'], dir .. '/ftplugin/qf.vim')
    filetype plugin on
    silent helpgrep grail
    cwindow
--- 709,715 ----
    var dir = 'Xruntime/after'
    &rtp ..= ',' .. dir
    mkdir(dir .. '/ftplugin', 'p')
!   writefile(['vim9script'], dir .. '/ftplugin/qf.vim')
    filetype plugin on
    silent helpgrep grail
    cwindow
*** ../vim-8.2.2510/src/version.c       2021-02-13 21:31:14.252539788 +0100
--- src/version.c       2021-02-13 21:57:55.181099619 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2511,
  /**/

-- 
ARTHUR:        I command you as King of the Britons to stand aside!
BLACK KNIGHT:  I move for no man.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202102141158.11EBw3XG1391413%40masaka.moolenaar.net.

Raspunde prin e-mail lui