How to jump to the end of pasted content after paste?

vim

Solution

By default, the `p` and `P` commands should leave the cursor at the last character of the pasted text. `gp` and `gP` go one character forwards (first character after pasted text).

When you paste text, you have marks `[` and `]` set to the beginning and end of pasted text. Therefore you can use ``[` and ``]` to move the cursor to begin/end of pasted content.

Problem

For example, my current file conent is: ``` Hello world! ^------------------vim cursor here ``` Vim cursor is at character `w`。And I paste a word `foobar`,the content changed to `Hello Hello wfoobarorld`, and cursor is at character `f`. But I want the cursor jump to `r` of `foobar` after paste immediately. Is there some command to do that?

Original source