@@ -2535,7 +2535,17 @@ compile_load(
25352535 case 's' : res = compile_load_scriptvar (cctx , name ,
25362536 NULL , NULL , error );
25372537 break ;
2538- case 'g' : isn_type = ISN_LOADG ; break ;
2538+ case 'g' : if (vim_strchr (name , AUTOLOAD_CHAR ) == NULL )
2539+ isn_type = ISN_LOADG ;
2540+ else
2541+ {
2542+ isn_type = ISN_LOADAUTO ;
2543+ vim_free (name );
2544+ name = vim_strnsave (* arg , end - * arg );
2545+ if (name == NULL )
2546+ return FAIL ;
2547+ }
2548+ break ;
25392549 case 'w' : isn_type = ISN_LOADW ; break ;
25402550 case 't' : isn_type = ISN_LOADT ; break ;
25412551 case 'b' : isn_type = ISN_LOADB ; break ;
@@ -2738,7 +2748,7 @@ compile_call(
27382748 if (compile_arguments (arg , cctx , & argcount ) == FAIL )
27392749 goto theend ;
27402750
2741- is_autoload = vim_strchr (name , '#' ) != NULL ;
2751+ is_autoload = vim_strchr (name , AUTOLOAD_CHAR ) != NULL ;
27422752 if (ASCII_ISLOWER (* name ) && name [1 ] != ':' && !is_autoload )
27432753 {
27442754 int idx ;
@@ -4986,7 +4996,10 @@ generate_loadvar(
49864996 generate_LOAD (cctx , ISN_LOADOPT , 0 , name , type );
49874997 break ;
49884998 case dest_global :
4989- generate_LOAD (cctx , ISN_LOADG , 0 , name + 2 , type );
4999+ if (vim_strchr (name , AUTOLOAD_CHAR ) == NULL )
5000+ generate_LOAD (cctx , ISN_LOADG , 0 , name + 2 , type );
5001+ else
5002+ generate_LOAD (cctx , ISN_LOADAUTO , 0 , name , type );
49905003 break ;
49915004 case dest_buffer :
49925005 generate_LOAD (cctx , ISN_LOADB , 0 , name + 2 , type );
@@ -5198,7 +5211,8 @@ generate_store_var(
51985211 opt_flags );
51995212 case dest_global :
52005213 // include g: with the name, easier to execute that way
5201- return generate_STORE (cctx , ISN_STOREG , 0 , name );
5214+ return generate_STORE (cctx , vim_strchr (name , AUTOLOAD_CHAR ) == NULL
5215+ ? ISN_STOREG : ISN_STOREAUTO , 0 , name );
52025216 case dest_buffer :
52035217 // include b: with the name, easier to execute that way
52045218 return generate_STORE (cctx , ISN_STOREB , 0 , name );
@@ -8007,6 +8021,7 @@ delete_instr(isn_T *isn)
80078021 {
80088022 case ISN_DEF :
80098023 case ISN_EXEC :
8024+ case ISN_LOADAUTO :
80108025 case ISN_LOADB :
80118026 case ISN_LOADENV :
80128027 case ISN_LOADG :
@@ -8017,6 +8032,7 @@ delete_instr(isn_T *isn)
80178032 case ISN_PUSHFUNC :
80188033 case ISN_PUSHS :
80198034 case ISN_RANGE :
8035+ case ISN_STOREAUTO :
80208036 case ISN_STOREB :
80218037 case ISN_STOREENV :
80228038 case ISN_STOREG :
0 commit comments