According to the documentation for gs:

go to sleep for N seconds (default 1)

Thus you can put Vim to sleep for 10 seconds using 10gs. What is a good use case for this command?

2 Answers 2


Short answer: None. That is, I believe it is a waste to map the easily accessible keys gs to sleep.

With that said, I often use the the :sleep command when I do testing and debugging of vimscript files. So the command itself is not useless. But when I do use it, I use it as part of a vimscript. After ~15 years of using Vim, I have never used gs to make Vim sleep.

  • 1
    Can you please elaborate, when can :sleep be useful for testing or debugging of vimscript files. Maybe just one example. Commented Jul 5, 2017 at 20:12
  • 2
    Two examples: Example 1 and example 2. Both examples use sleep to ensure that some backgrounded processes finish properly before continuing execution. In the last example, I have automated a test of some vimtex commands, and sleep is handy here also to give some time to inspect output before continuing execution. Commented Jul 6, 2017 at 8:18

I’ve used it in macros. For instance, if there’s an asynchronous task (like format on save) that needs to complete before the rest of your macro continues, you can throw a 1gs in there, it’ll get saved to your macro, and it will pause there for 1 second before it continues

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.