Search code examples
vimpaste

Cursor positioning after pasting content in Vim


When I use the command

:r (path to file)

it will paste the content of the file that I want. Is there any way to move the cursor to the end after pasting, since command mentioned keep the cursor at where it pasted the content?


Solution

  • '] moves the cursor to the last yanked/inserted/pasted line. j moves the cursor to the next line. So :r filename CR']j should do what you want (line after the inserted text).

    Alternately, staying entirely in command-line mode, :r filename | ']+1.

    (:help :read, :help '], :help :[range])