Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Automating Repetitive Text Editing with Vim Macros

Don’t you just hate it when you have to do some Repetitive Text Editing, such as wrapping several lines of text in <li>...</li> tags or just about anything involving tables? (Actually, HTML is a veritable goldmine of repetition…) If you use vim, you can whip up macros on-the-fly to reduce this sort of tedium.

The commands to know are:

  • q — Start or stop macro recording. When starting, it should be used with a letter from a to z, which is the register it will record into. (So you can have more than one macro in memory at once.) The command is used singularly to end recording.
  • @ — Play back the macro. Use it in the form of @a to play the macro in register a.
  • @@ — Play the last-played macro again.

Rather than explain it in textual form, I recorded a short screencast that illustrates the basics of using macros in vim.



This post first appeared on Webmaster-Source | Blogging Tips, Webmaster Resour, please read the originial post: here

Share the post

Automating Repetitive Text Editing with Vim Macros

×

Subscribe to Webmaster-source | Blogging Tips, Webmaster Resour

Get updates delivered right to your inbox!

Thank you for your subscription

×