Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently converted from TextMate to MacVim with Janus for editing my markdown files.

How can I reformat an old markdown file so that lines longer than 79 characters are converted from a single line into multiple lines?

share|improve this question
up vote 1 down vote accepted

Try this:

:set textwidth=79

Then gggq}

share|improve this answer
Can you please explain what this does? It worked, I'm just curious because it was awesome. – Kyle Jul 27 '14 at 18:45
This is in reference to Kyle's question above: The command :set allows you to change vim's config in the local instance (as opposed to putting this setting in ~/.vimrc and making it persist to all instances). The next line can be broken down to smaller parts. First, gg is an motion moving you to the top of the page (usually, see And gq} is a text-formatting command (explained here – 0dyss3us Oct 16 '14 at 17:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.