2

I'm currently using yyp or yy(n)p to duplicate lines. Can I do it without yanking lines?

3 Answers 3

6

If you use :co. then the " register will be left alone.

1
2

View Duplicate a whole line in Vim

Explicitly the not so upvoted answers (like :t.). - but why not yyp?

2
  • I'm using clipboard as vim's default register. So when I duplicate a line, vim is writing the line over system clipboard. May 15, 2017 at 21:45
  • Your solution working well too, bu I should accept Josh's answer because he is first. Sorry :( May 15, 2017 at 21:46
0

You can delete the line with dd and then paste (put) it with p multiple times. E.g. 2p to duplicate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.