@@ -8861,11 +8861,13 @@ compile_put(char_u *arg, exarg_T *eap, cctx_T *cctx)
88618861 * A command that is not compiled, execute with legacy code.
88628862 */
88638863 static char_u *
8864- compile_exec (char_u * line , exarg_T * eap , cctx_T * cctx )
8864+ compile_exec (char_u * line_arg , exarg_T * eap , cctx_T * cctx )
88658865{
8866+ char_u * line = line_arg ;
88668867 char_u * p ;
88678868 int has_expr = FALSE;
88688869 char_u * nextcmd = (char_u * )"" ;
8870+ char_u * tofree = NULL ;
88698871
88708872 if (cctx -> ctx_skip == SKIP_YES )
88718873 goto theend ;
@@ -8922,6 +8924,34 @@ compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
89228924 nextcmd = p + 1 ;
89238925 }
89248926 }
8927+ else if (eap -> cmdidx == CMD_command || eap -> cmdidx == CMD_autocmd )
8928+ {
8929+ // If there is a trailing '{' read lines until the '}'
8930+ p = eap -> arg + STRLEN (eap -> arg ) - 1 ;
8931+ while (p > eap -> arg && VIM_ISWHITE (* p ))
8932+ -- p ;
8933+ if (* p == '{' )
8934+ {
8935+ exarg_T ea ;
8936+ int flags ; // unused
8937+ int start_lnum = SOURCING_LNUM ;
8938+
8939+ CLEAR_FIELD (ea );
8940+ ea .arg = eap -> arg ;
8941+ fill_exarg_from_cctx (& ea , cctx );
8942+ (void )may_get_cmd_block (& ea , p , & tofree , & flags );
8943+ if (tofree != NULL )
8944+ {
8945+ * p = NUL ;
8946+ line = concat_str (line , tofree );
8947+ if (line == NULL )
8948+ goto theend ;
8949+ vim_free (tofree );
8950+ tofree = line ;
8951+ SOURCING_LNUM = start_lnum ;
8952+ }
8953+ }
8954+ }
89258955 }
89268956
89278957 if (eap -> cmdidx == CMD_syntax && STRNCMP (eap -> arg , "include " , 8 ) == 0 )
@@ -9008,6 +9038,7 @@ compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
90089038 -- nextcmd ;
90099039 * nextcmd = '|' ;
90109040 }
9041+ vim_free (tofree );
90119042
90129043 return nextcmd ;
90139044}
0 commit comments