Skip to content

Commit dc44a5a

Browse files
committed
🐛 Make behavior of echo consistent between Vim/Neovim
1 parent 9700f97 commit dc44a5a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

denops_std/helper/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ export async function main(denops: Denops): Promise<void> {
2222
}
2323
```
2424

25+
##### Warning
26+
27+
In order to make the behavior of Vim and Neovim consistent, `timer_start()` is
28+
used internally not only in Vim but also in Neovim. Note that this means that it
29+
is not possible to control messages by prepending `silent` to them. Developers
30+
must control the display of messages by not calling this function.
31+
2532
### friendlyCall
2633

2734
Use `friendlyCall()` to call given function and print a friendly error message

denops_std/helper/echo.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,19 @@ async function ensurePrerequisites(denops: Denops): Promise<string> {
3636
*
3737
* Note that it does nothing and return immediately when denops is
3838
* running as 'test' mode to avoid unwilling test failures.
39+
*
40+
* WARNING:
41+
* In order to make the behavior of Vim and Neovim consistent, `timer_start()`
42+
* is used internally not only in Vim but also in Neovim. Note that this
43+
* means that it is not possible to control messages by prepending `silent`
44+
* to them. Developers must control the display of messages by not calling this
45+
* function.
3946
*/
4047
export function echo(denops: Denops, message: string): Promise<void> {
4148
if (denops.meta.mode === "test") {
4249
return Promise.resolve();
43-
} else if (denops.meta.host === "vim") {
44-
return echoVim(denops, message);
4550
} else {
46-
return denops.cmd("redraw | echo message", { message });
51+
return echoVim(denops, message);
4752
}
4853
}
4954

0 commit comments

Comments
 (0)