How do I jump to the start or end of the text I just yanked or changed?
Answer
'[ and ']
Explanation
Vim automatically sets two marks whenever you yank, change, delete, or paste text: `[ (backtick-bracket) marks the start of the affected region, and `] marks the end. Using '[ and '] (single-quote variants) jump to the first column of those lines. These marks persist until the next operation that sets them.
How it works
`[— jump to the exact position of the first character of the last changed/yanked text`]— jump to the exact position of the last character of the last changed/yanked text'[/']— line-level versions (jump to line start, like any'mark)
The marks are set by: y (yank), d (delete), c (change), p/P (put), and : commands that modify the buffer.
Example
You yank a multi-line block with yip (yank inner paragraph). You navigate away and do other edits. Later:
`[ " jump back to first char of what you yanked
`] " jump to last char of what you yanked
A powerful pattern — re-select the last yanked region and operate on it:
`[v`] " visually select exactly the text you yanked
Or apply an operator to the yanked region directly:
`[=`] " re-indent whatever you just yanked (great after pasting)
Tips
- After pasting with
p, use`[=`]to immediately re-indent the pasted block to match surrounding code :help '[shows all the automatic marks Vim maintains, including'<and'>for the last visual selection