How do I execute a command on all the lines containing a pattern?
You can use the “:global” (:g) command to execute a command on all the lines containing a pattern.
:g/my pattern/d
If you want to use a non-Ex command, then you can use the “:normal” command:
:g/my pattern/normal {command}
Unless you want the normal mode commands to be remapped, consider using a “:normal!” command instead (note the “!”).
Comments (1)
Pepsh Pepshinsky
Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE