Skip to content

Instantly share code, notes, and snippets.

@syranez
Created July 22, 2012 11:20
Show Gist options
  • Save syranez/3159364 to your computer and use it in GitHub Desktop.
Save syranez/3159364 to your computer and use it in GitHub Desktop.
lame macro example in vim

Todo: Delete the second 'o'.

foobar
foobar
foobar
foobar
foobar

In vim with macro:

  1. position your cursor on (1/1)

  2. record macro: qallxhhjq

    q = start/stop macro recording
    a = name of macro for invocation
    llxhhj = macro body, commands to execute (very lame solution: right, right, delete character, left, left, one line down
    the "one line down" is important if you do want execute the macro multiple times!

  3. position your cursor on (1/1)

  4. invoke macro a: 5@a

Result:

fobar
fobar
fobar
fobar
fobar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment