Have your autocmd command be setup like this:

autocmd User ALELintPost call SayHello() " ALELintPost is async

And your SayHello function set up like this

function! SayHello() abort
    echo "Hello World!"

The function correctly executes, but the message isn't echoed.


function! SayHello2() abort
    echo "Hello World!"

function! SayHello() abort
    let timer=timer_start(500, { timer -> execute('call SayHello2()') }) " Or however you wanna call, really... It doesn't work

Also doesn't work.

There is a library called Echodoc who seems to be dedicated to printing stuff there (it's also a plugin). It uses the typical echo methods like I'm currently trying to.


Perhaps it's able to echo directly because the methods aren't asynchronous?

Is there some register/buffer/place I can write to in order to cheat this?

Or am I doing something wrong?

Please let me know!

I found out a solution and posted the answer below.

  • timer_start is invalid syntax. you must use call timer_start( because it is a function
    – Mass
    Aug 12, 2018 at 17:42
  • Thanks @Mass but that wasn't it. That code I posted there was just a snippet I wrote by hand for exemplifying purposes. Still, thanks for trying to help! Aug 13, 2018 at 3:20

1 Answer 1


The solution for my case is to use Vim's sandbox command.


I don't know how it works internally, but it solves my problem.

function! SayHello2()
    let g:GLOBAL_VAR='WORKS!' " Sandboxed functions accesses the global context normally
    echo "Hello World!"

function! SayHello()
    sandbox call SayHello2()

autocmd User ALELintPost call SayHello()

As it can be seen in the example above, you can still access the global scope, execute commands and perform most "function stuff" inside of the sandboxed context.

However, since Vim claims it controls the evaluation's side-effects in some way, it might not work exactly as a regular function call for every single case. It works for mine. : - ]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.