If you need to do something like, search for all new lines and add the new line plus "foo" do the following: :1,%s/\n/^Mfoo/g You get the ^M character by pressing ctrl-v and then hitting enter.