9

according to 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?

8

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. – Anurag Peshne Jul 5 '17 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. – Karl Yngve Lervåg Jul 6 '17 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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