vimtricks.wiki Concise Vim tricks, one at a time.

How do I join a wrapped paragraph into one line without manual cursor moves?

Answer

vipJ

Explanation

When text is hard-wrapped for readability in git diffs or markdown source, you sometimes need the paragraph as a single line for refactoring, search, or export. vipJ is a fast way to do that without manually stepping line by line.

How it works

vipJ
  • v enters Visual mode.
  • ip selects the inner paragraph around the cursor.
  • J joins all selected lines, inserting proper spacing.

Because ip is semantic (paragraph-aware), this scales better than repeated J on individual lines and avoids accidental joins across blank-line boundaries. It is especially useful when normalizing wrapped comments, commit message bodies, or prose paragraphs before running substitutions.

Example

Before:

Vim users often
split prose across
many short lines.

After vipJ:

Vim users often split prose across many short lines.

Tips

  • Use gJ instead of J if you need to join without inserting spaces.
  • Combine with . to repeat the same paragraph join on nearby sections.
  • If you only want part of a paragraph, use a custom Visual selection and press J.

Next

How do I let h/l and arrow keys wrap to adjacent lines at line boundaries?