normal·mode
~ / macros / macro-on-many-lineslesson 3/6

Run a macro on many lines: :normal @a

Apply a macro to every line of a range, skipping the lines where it fails.

3 drills

  1. Every line, failures skipped: Register a already holds a macro that uppercases the name at the start of a setting. Run it on every line with :%normal @a. Lines it can't handle (comments) make it fail, and :normal just moves on.
  2. Just this paragraph: Run the macro in register a on the paragraph the cursor is in, and nowhere else. Select it with vip, then type :normal @a (Vim fills in the '<,'> range).
  3. Only the matching lines: Run the macro in register a only on the lines that contain the text that marks them (compare with the target), using :g/{text}/normal @a.

The drill editor loads in your browser.

outside the editor the page is in normal mode: ? keymaps · / find · : commandsfound this useful? ☕ support it ·credits · source · not affiliated with Vim or Neovim