Reputation: 2186
A word needs to be injected at the beginning of each line 1
. I tried the following, but obviously it does not work :g/^=/+1i/myword/
File structure:
===============
line 1
line 2
...
===============
line 1
line 2
...
Upvotes: 2
Views: 1514
Reputation: 997
You can also do it by :s
command:
:%s/=\n\zs/myword
\zs
denotes that preceding pattern is zero-width, which is just used as a matching condition, and won't be captured.
Upvotes: 4
Reputation: 196546
You are almost there:
:g/^=/+1normal Imyword
Note that +1
could be shortened to +
and :normal
to :norm
:
:g/^=/+norm Imyword
See :help :insert
for why your method couldn't work and :help :normal
.
Upvotes: 6