This blog uses Pelican, which is a pretty neat way of having a set of text files written in reStructuredText, or Markdown, or perhaps some other system (I haven't checked, I am comfortable with Markdown), compile them into linked HTML files and having them uploaded to your hosting via SSH or similar. No dynamic engine, nothing that needs to be updated, no maintenance, nothing.

For a while, I edited my documents using vim and didn't apply any kind of wrapping to my text files, so lines could get really long. This is OK, but it is a bit annoying having to remember to move between lines that belong to the same paragraph using gj and gk.

I decided to do hard wrapping to Markdown files: have vim break lines longer than 80 characters. Markdown is aware of this, and it needs to have an empty line between paragraphs, so this is not formatting my document in any way, which is good. In order to do this, I simply added this to ~/.vim/ftplugin/markdown.vim:

setl tw=80
setl fo=want

And this was enough (see :help fo-table for more info) and worked well almost all of the time. However, it happened that, from time to time, I found line breaks that shouldn't be there. Not paragraph breaks, mind this, but a phrase ended and the next one was starting on it's own line right below the previous one.
Something like this. Ugly.

I went crazy for a while and I discovered two things:

  1. Turns out that markdown inserts a new line when there are two spaces at the end of the previous one.
  2. It also turns out that, if the option set js (:help js) is active in vim, it will insert two spaces when joining lines (which it was doing automatically due to the fo option settings) after a ., a ? and a !.

The combination of these two was the cause of all my headaches. So now my vim configuration for these files is:

setl tw=80
setl fo=want 
setl nojs

And it works beautifully.