How do I jump between paragraphs in Vim?
Answer
{ and }
Explanation
The { and } commands move the cursor by paragraph — jumping to the previous or next blank line. They are among the fastest ways to navigate through structured text and code.
How it works
}moves the cursor forward to the next blank line (the end of the current paragraph){moves the cursor backward to the previous blank line (the beginning of the current paragraph)- A "paragraph" in Vim is defined as a block of text separated by one or more empty lines
Example
Given the text:
function greet() {
console.log("hello");
}
function farewell() {
console.log("goodbye");
}
function main() {
greet();
farewell();
}
With the cursor on the first line, pressing } jumps to the blank line after the greet function. Pressing } again jumps to the blank line after farewell. Pressing { jumps back up to the previous blank line.
Tips
- Use
d}to delete from the cursor to the end of the current paragraph - Use
y}to yank the current paragraph - Use
vipto visually select the inner paragraph (excluding surrounding blank lines) - Use
vapto select the paragraph including one trailing blank line - Use
3}to jump forward three paragraphs at once - These motions are especially useful in code files where functions or blocks are separated by blank lines
- Both
{and}are jump motions, so they are recorded in the jump list and you can return with<C-o>