How to Quickly Store Vim Macros on Mac OS

The aim of this pageđź“ť is to describe making mass changes in vim known as macrod/command recording adding the counter-intuitive insight that on new Mac OSs/new Vim the macros are recorded automatically. I am using this currently just for a simple checkbox adder (newline + - [ ] ) and checker (changing empty checkbox into - [x] once I am done)

Pavol Kutaj
2 min readFeb 13, 2024
PROMPT >>> Jackson Pollock desired to contribute \ to the productivity porn scene \ with the beautiful
sculpture \ of the checkbox <<<
  1. press q<register_name>, e.g. qa
  2. type commands here
  3. press q
  4. position yourself to the location of beginning of mass-change
  5. run the macro by @<reqister_name>, e.g. @a
  6. to repeat the call of the previously executed macro, press @@
  • On macOS with vim 8.x and newer — the actions are automatically stored in the .viminfo file.
  • The suggestions of https://stackoverflow.com/questions/2024443/saving-vim-macros are no longer relevant — at least for basic tssks
  • The .viminfo file is a persistent storage file that Vim uses to store various information, including recorded macros.
  • The recorded macro will be stored in the specified register and will be available for future use, even after restarting Vim or logging out of mac OS.
  • To record a macro, press “q” followed by a register key, perform the actions, and press “q” again to stop recording.

LINKS

--

--

Pavol Kutaj

Today I Learnt | Infrastructure Support Engineer at snowplow.io with a passion for cloud infrastructure/terraform/python/docs. More at https://pavol.kutaj.com