If I'm running a complex macro on a large file that I expect to take a few minutes, is it OK to do other stuff on the system (e.g. opening another application, typing in a different text editor, etc?) or could my mouse movements and keyboard inputs cause the macro to go nuts?

  • 2
    Why do you believe this to be the case ... ? – Martin Tournoij Aug 21 '15 at 15:38
  • Using another system where a "macro" intimidated key strokes and mouse movements. Based on your comment, it sounds like my question might be absurd. – Scribblemacher Aug 21 '15 at 16:07

Indeed it is pretty safe to manipulate other programs while a macro is executed.

A macro simulates keystrokes within Vim which has no interaction with external GUI applications.

As macros don't depend on the movement of the mouse, no conflicts can appear (Or at least I've never experienced them or heard of someone who has).

EDIT As Sato observed in the comments, one element is shared between Vim and other applications: the clipboard. That means that if your Vim macro uses the system clipboard and you copy something new while it is executed, you might have unexpected results.

The best solution to this problem is to put the content of your system clipboard into a Vim register before recording the macro and to use this register in the macro.

  • All true, but beware that cut & [wp]aste operations with the mouse outside Vim can interfere with the contents of Vim's clipboard if done at the wrong moment. – Sato Katsura Aug 22 '15 at 9:20
  • @SatoKatsura: You're totally right, I'll add this observation to my answer. – statox Aug 22 '15 at 10:12

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.