Say I\'m editing my _vimrc
file and I\'ve just added a couple of lines, for instance a new key mapping. I don\'t want to reload the whole file (:so %
The accepted answer doesn't handle continuation sections. Also, surprisingly, the bar isn't needed, newlines are fine. This will work, first yanking the text into register x:
vno "xy:exe substitute(@x,"\n\\",'','g')
As someone has already mentioned, the only exception are commands that "eat up" newlines. Eg, executing the above mapping on:
:sign define piet text=>> texthl=Search
:exe ":sign place 2 line=23 name=piet file=" . expand("%:p")
will cause vim to to think that the user is trying to define textl as "Search\n:exe ":sign place... etc.