Copy till Particular line VIM Command

How to use Copy till Particular line Command in Linux VIM editor?


y<count>G stands for Yank Group till particular line
This command is used to copy the text from the current line to the Nth line of the file. This current position may be before or after the Nth line.




  • 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 the text from first line to fourth line
  • Move the cursor to the 'Hiox India'
  • To copy the lines till fourth line to clipboard
    Press y4G
  • Using put command we can paste the copied content
    Press p
  • The copied content will be pasted
    Copy till Particular Line (ynG) Vim Command

Ask Questions

Ask Question