Mercurial > vim
comparison src/ex_docmd.c @ 27978:442ca2007bec v8.2.4514
patch 8.2.4514: Vim9: some flow commands can be shortened
Commit: https://github.com/vim/vim/commit/b2175220dafc28349b275ac7f3080f89cce78a57
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 5 20:24:41 2022 +0000
patch 8.2.4514: Vim9: some flow commands can be shortened
Problem: Vim9: some flow commands can be shortened.
Solution: Also require using the full name for ":return", ":enddef",
":continue", ":export" and ":import".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 05 Mar 2022 21:30:03 +0100 |
parents | 212c5894b8b1 |
children | dd2ed5345f20 |
comparison
equal
deleted
inserted
replaced
27977:9432710dac71 | 27978:442ca2007bec |
---|---|
3751 break; | 3751 break; |
3752 } | 3752 } |
3753 | 3753 |
3754 // :Print and :mode are not supported in Vim9 script. | 3754 // :Print and :mode are not supported in Vim9 script. |
3755 // Some commands cannot be shortened in Vim9 script. | 3755 // Some commands cannot be shortened in Vim9 script. |
3756 // ":continue" needs at least ":cont", since ":con" looks weird. | |
3757 if (vim9 && eap->cmdidx != CMD_SIZE) | 3756 if (vim9 && eap->cmdidx != CMD_SIZE) |
3758 { | 3757 { |
3759 if (eap->cmdidx == CMD_mode || eap->cmdidx == CMD_Print) | 3758 if (eap->cmdidx == CMD_mode || eap->cmdidx == CMD_Print) |
3760 eap->cmdidx = CMD_SIZE; | 3759 eap->cmdidx = CMD_SIZE; |
3761 else if (((cmdnames[eap->cmdidx].cmd_argt & EX_WHOLE) | 3760 else if ((cmdnames[eap->cmdidx].cmd_argt & EX_WHOLE) |
3762 && len < (int)STRLEN(cmdnames[eap->cmdidx].cmd_name)) | 3761 && len < (int)STRLEN(cmdnames[eap->cmdidx].cmd_name)) |
3763 || (eap->cmdidx == CMD_continue && len < 4)) | |
3764 { | 3762 { |
3765 semsg(_(e_command_cannot_be_shortened), eap->cmd); | 3763 semsg(_(e_command_cannot_be_shortened_str), eap->cmd); |
3766 eap->cmdidx = CMD_SIZE; | 3764 eap->cmdidx = CMD_SIZE; |
3767 } | 3765 } |
3768 } | 3766 } |
3769 | 3767 |
3770 // Do not recognize ":*" as the star command unless '*' is in | 3768 // Do not recognize ":*" as the star command unless '*' is in |