How can you refer to the match in the command g in Vim?
I would like to put X after the match without replacing the match.
For instance, in the following command without writing the create_title twice.
:g/create_title/s/create_title/X/
You should get
create_titleX
by running the command to
create_tile
I’m not sure why you need the
gportion of the command – the substitute will only act on matching lines. Here’s what you’re looking for:The
&represents the entire text which was matched.