Vim, Markdown and WordPress

No Comments »

It’s really cool that one can write blog locally and submit to WordPress host remotely. Markdown makes it even cooler because its beautiful syntax!

This is a pretty good step-by-step tutorial teaching you how to achieve that. Just follow it.

The core plugin to make it cool is VimRepress. It requires:

  • Vim 7.3+ with python 2.6/2.7 support
  • Python Environment matched with Vim’s support
  • python-markdown/python-markdown2 installed
  • worldpress 3.0.0+

For people who are using Mac – the Vim comes with MacOSX does not have python support. You can run:

/usr/bin/vim --version | grep python
1
/usr/bin/vim --version | grep python

to check that.

So I use MacVim from Homebrew. However MacVim crashes as soon as I start using VimRepress. After Google I found this. Looks like something goes wrong and make it broken when MacVim is built with 64 bit with Python support. So to get it work you need to reinstall MacVim and build it with 32 bit. Since there is no option for that I directly modified the formula file:

brew edit macvim
1
brew edit macvim

Find this line:

arch = MacOS.prefer_64_bit? ? 'x86_64' : 'i386'
1
arch = MacOS.prefer_64_bit? ? 'x86_64' : 'i386'

Comment it out and replace with:

arch = 'i386'
1
arch = 'i386'

Save and run:

brew install macvim --HEAD
1
brew install macvim --HEAD

You may also need to recompile your Python if you installed it from Homebrew and only compiled with 64 bit.

brew uninstall python
brew install python --universal
1
2
brew uninstall python
brew install python --universal

Then you get it!

This post is edited with Markdown syntax in Vim and submitted via VimRepress ;)