How do i delete a block of text in vim and position it somewhere else in the file?



  • Man page for vim.

    Sample text.

    Get Back, get back again and again
    I've been here since I can remember when
    My life is a boat, being blown by you
    With nothing ahead, just the deepest blue
    
    To me you're like a setting sun
    You rise then you're gone
    To me you're like a setting sun
    You rise then you're gone
    

    I want to delete lines 6 and 7 and position them somewhere else in the file.

    Press v on the keyboard (lowercase), use cursor keys to got to the end of the line 6 and press the down cursor key, you should be both line selected now.

    vim_delete1.png

    Press d on the keyboard (lowercase).

    Now position the cursor on the line you want the deleted text. I want the text above the first line, so I position the cursor on the G on the first line.

    vim_position1.png

    Then I press the uppercase P this is what I get.

    vim_position2.png



© Lightnetics 2024