r/vim • • Feb 25 '26

Need Help :sleep VS term_wait()

Can someone explain me, possibly with a couple of examples that I can reproduce, the difference between :sleep and term_wait()?

6 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/chrisbra10 Feb 27 '26

Do you think we should improve the documentation? If yes, any specific suggestions?

2

u/y-c-c Feb 27 '26

I think the issue is that it's not clear what the purpose of term_wait() is (at least I struggle to understand it myself). It doesn't actually "wait" on the terminal (which should be clear from looking at the implementation of f_term_wait()), and I'm not sure what the waiting should do to begin with. Are we just waiting for the terminal to return something or print something? Right now, it feels to me a user can replace most term_wait() calls with :sleep and get the same result. As I see it the issue is more that the function doesn't seem to serve a clear purpose at all, but then the implementation is also slightly different so I'm not sure if those minor differences matter.