File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { Denops } from "../deps.ts" ;
2
2
import { batch } from "../batch/mod.ts" ;
3
+ import { load } from "./load.ts" ;
3
4
4
5
/**
5
6
* Echo message as like `echo` on Vim script.
@@ -16,10 +17,7 @@ export function echo(denops: Denops, message: string): Promise<void> {
16
17
if ( denops . meta . mode === "test" ) {
17
18
return Promise . resolve ( ) ;
18
19
} else if ( denops . meta . host === "vim" ) {
19
- return denops . cmd (
20
- "call timer_start(0, { -> execute('redraw | echo message', '') })" ,
21
- { message } ,
22
- ) ;
20
+ return echoVim ( denops , message ) ;
23
21
} else {
24
22
return denops . cmd ( "redraw | echo message" , { message } ) ;
25
23
}
@@ -62,3 +60,8 @@ export async function friendlyCall(
62
60
}
63
61
}
64
62
}
63
+
64
+ async function echoVim ( denops : Denops , message : string ) : Promise < void > {
65
+ await load ( denops , new URL ( "./echo.vim" , import . meta. url ) ) ;
66
+ await denops . call ( "DenopsStdHelperEcho" , message ) ;
67
+ }
Original file line number Diff line number Diff line change
1
+ if exists (' g:loaded_denops_std_helper_echo' )
2
+ finish
3
+ endif
4
+ let g: loaded_denops_std_helper_echo = 1
5
+
6
+ function ! DenopsStdHelperEcho (message) abort
7
+ call timer_start (0 , { - > s: echo (a: message ) })
8
+ endfunction
9
+
10
+ function ! s: echo (message) abort
11
+ redraw | echo a: message
12
+ endfunction
You can’t perform that action at this time.
0 commit comments