Vim quicktip #5: `gq{motion}` wraps lines to fit the configured textwidth (`:set textwidth`). If textwidth is not set, #vim will use the screen width (with a maximum of 79).

Use `gqq` to format the current line, or `gq` in visual select mode to format all selected lines.


@jkreeftmeijer also: "gqap" reformats the current paragraph

@judofyr I generally use a visual selection with `gq`, but actually using the motions would indeed be faster. I’ll try to get `gqap` into my muscle memory. Great addition, thanks!

Sign in to participate in the conversation

A Mastodon instance for Rubyists & friends