Take the 2-minute tour ×

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

1 Answer 1

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 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 vimdoc.sourceforge.net/htmldoc/motion.html#gg). And gq} is a text-formatting command (explained here vimdoc.sourceforge.net/htmldoc/change.html#gq) –  0dyss3us Oct 16 at 17:45

Your Answer


