Copy Multiple lines VIM Command

How to use Copy Multiple lines Command in Linux VIM editor?


<count>yy stands for Yank Multiple Line
This command is used to copy the N number of lines from the current line from the file.




  • Open the file test.txt using the command
    $ vim test.txt
  • We can notice the text in the file.
    Hiox India
    Vim Tutorial
    Line 1
    Line 2
    Line 3

  • Let us see how to copy 2 lines from the second line.
  • Move the cursor to the second line, from which we have to copy 2 lines.
  • To copy the lines to clipboard
    Press 2yy
  • Using put command we can paste the copied content
    Press p
  • The copied content will be pasted
    Copy Multiple Lines (nyy) Vim Command

Ask Questions

Ask Question