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
venters Visual mode.ipselects the inner paragraph around the cursor.Jjoins 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
gJinstead ofJif 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.