File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 1- import { Denops } from "./deps.ts" ;
1+ import { Context , Denops } from "./deps.ts" ;
22
33/**
44 * Execute Vim script directly
55 */
66export async function execute (
77 denops : Denops ,
88 command : string | string [ ] ,
9+ context : Context = { } ,
910) : Promise < void > {
1011 if ( Array . isArray ( command ) ) {
11- await denops . cmd ( "call execute(l:command, '')" , {
12- command : command
12+ context = {
13+ ...context ,
14+ __denops_internal_command : command
1315 . map ( ( x ) => x . replace ( / ^ \s + | \s + $ / g, "" ) )
1416 . filter ( ( x ) => ! ! x ) ,
15- } ) ;
17+ } ;
18+ await denops . cmd ( "call execute(l:__denops_internal_command, '')" , context ) ;
1619 return ;
1720 }
1821 command = command . replace ( / \r ? \n \s * \\ / g, "" ) ;
19- await execute ( denops , command . split ( / \r ? \n / g) ) ;
22+ await execute ( denops , command . split ( / \r ? \n / g) , context ) ;
2023}
Original file line number Diff line number Diff line change @@ -39,8 +39,11 @@ export class Vim {
3939 return await this . #denops. eval ( expr , context ) ;
4040 }
4141
42- async execute ( command : string | string [ ] ) : Promise < void > {
43- await execute ( this . #denops, command ) ;
42+ async execute (
43+ command : string | string [ ] ,
44+ context : Context = { } ,
45+ ) : Promise < void > {
46+ await execute ( this . #denops, command , context ) ;
4447 }
4548
4649 async autocmd (
You can’t perform that action at this time.
0 commit comments