Lets combine two powerful Vim modes: normal mode and command line mode. Chaining both allows you to repeat the same normal mode action across several lines at once. Suppose you want to remove the last character on each line of a selection, you can simply run this:

:norm $x

Gif exemplifying “removing last character” and “wrapping lines in HTML tags”

This will repeat the normal mode action “$x” — which means: go to last character of the line ($) and then crop it (x)— on each line of the selection.

You can also combine it with Macros. It will allow you simplify repetitive and — otherwise complex — editing tasks. For example, here is how to wrap all selected lines in a HTML tag:

In normal mode: Create a macro that wraps a single line into a tag In command line mode: Apply the macro in each line of the selection

Let’s say you recorded the macro on the “a” key, you would only have to select the lines and run:

:norm @a

This will wrap all the selected lines into HTML tags.

Hope you enjoyed and will use that soon ☺