Say i have line stored in buffer k. how do I replace some line with the content of the buffer?
You can use ctrl-v and select what you want to copy and press "y" to "yank" it. Then ctrl-v or shift-v to select the "some lines" that you want to replace and press "p" to paste it.
go anywhere on the line to be replaced. Execute a buffer P (Put above). Use dd to delete the current line.
so "xPdd
The quote key " is what you need. That makes your yank/put register specific. So you have something in register k and you wanted to replace the current line with it you'd type:
^c$<esc>"kp
best way i can think on the spot is
"ayy (this yanks / copies the line to the "a buffer
then
dd (delete the line to the standard buffer)
then
"aP which inserts buffer"a before the current line
As others have said, the overall answer is to use dd"kP. I'd like to add that you might want to use :g, so that if you want to replace all lines that match 'foo' with the content of register k, you can do:
:g/foo/normal dd"kP
Note that using p instead of P will cause some problems if the first line of your buffer matches the pattern.