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" ;
2
2
3
3
/**
4
4
* Execute Vim script directly
5
5
*/
6
6
export async function execute (
7
7
denops : Denops ,
8
8
command : string | string [ ] ,
9
+ context : Context = { } ,
9
10
) : Promise < void > {
10
11
if ( Array . isArray ( command ) ) {
11
- await denops . cmd ( "call execute(l:command, '')" , {
12
- command : command
12
+ context = {
13
+ ...context ,
14
+ __denops_internal_command : command
13
15
. map ( ( x ) => x . replace ( / ^ \s + | \s + $ / g, "" ) )
14
16
. filter ( ( x ) => ! ! x ) ,
15
- } ) ;
17
+ } ;
18
+ await denops . cmd ( "call execute(l:__denops_internal_command, '')" , context ) ;
16
19
return ;
17
20
}
18
21
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 ) ;
20
23
}
Original file line number Diff line number Diff line change @@ -39,8 +39,11 @@ export class Vim {
39
39
return await this . #denops. eval ( expr , context ) ;
40
40
}
41
41
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 ) ;
44
47
}
45
48
46
49
async autocmd (
You can’t perform that action at this time.
0 commit comments