Paste an entire cut line at the end of another line in vim

command linevim

I cut a line with dd and then I want to paste the entire line at the end of another line. But the problem is that because dd cuts the entire line, it's including the newline character probably too.

And so when I paste via p, it automatically puts it on the next line. And if I do Shift + p, it puts it before the line I'm trying to paste on.

So is there a way to paste the entire line I cut at the end of a line?

Best Answer

To cut a line without new line, you can press d$ or D from cursor location. To paste it at the end of another line, you can go to its end and just press p. In case, if you are not able to paste the line as you expected, you can go to the end of line where you wanted to paste. Then, press i and then press <C-R> (Control-R) and " (double quotes). Your recently cut or copied text will be pasted.

Related Question