0

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?

1

Try this:

:set textwidth=79

Then gggq}

2
  • 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 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 '14 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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