Managing Wordpress Blog From Vim Using VimRepress Plugin

Recipe # | posted in Faq, Hack, Howto, Linux | Comments

1 – Problem Description

How to manage a wordpress blog using vim/vi and VimRepress plugin.

2 – Solution

The following instructions assume Ubuntu/Mint operating system.

  1. Install mercurial

    sudo apt-get install mercurial

  2. Install python2.6-dev in your pc

    sudo apt-get install python2.6-dev

  3. Compile Vim 7.3+ with python 2.6 support

    cd hg clone https://vim.googlecode.com/hg/ vim cd vim/src make ./configure —prefix=$HOME —enable-multibyte —enable-pythoninterp —with-python-config-dir=/usr/lib/python2.6/config make make install

—enable-multibyte enables the encoding option of vim in order to avoid the failure of VimRepress. This was fixed by a later commit 4157b7f3246e fix: add warnning instead failure while checking encoding

If you get the following or similar error:

You need to install a terminal library; for example ncurses.

Then, you should install libncurses5-dev package in your pc.

sudo apt-get install libncurses5-dev
  1. Now it’s time to install the vim plugin in your home folder

    cd ~/ mkdir .vim cd .vim mkdir plugin cd plugin hg clone https://bitbucket.org/pentie/vimrepress cd vimrepress/plugin

Create file ~/.vimpressrc and add the following,

[Blog1]
blog_url = http://your-first-blog.com/
username = user
password = pass

[Blog2]
blog_url = http://your-second-blog.com/
username = user2
password =

As you can see from the example above, multiple blog configurations are supported. Hardcoding the password is optional. If a password is not provided the plugin will prompt for one the first time it’s needed. If you need markdown support, simply run

sudo apt-get install python-markdown
  1. Install wordpress 3.+

  2. Use VimRepress (copy/paste from vimrepress page)

    :BlogList – List 30 recent posts. :BlogList page – List 30 recent pages. :BlogList post 100 – List 100 recent posts.

    :BlogNew post – Write an new post. :BlogNew page – Write an new page.

    :BlogSave – Save (default is published.) :BlogSave draft – Save as draft.

    :BlogPreview local – Preview page/post locally in your browser. :BlogPreview publish – Same as :BlogSave publish with browser opened.

    :BlogOpen 679 :BlogOpen http://your-first-blog.com/archives/679 :BlogOpen http://your-second-blog.com/?p=679 :BlogOpen http://your-third-blog.com/with-your-custom-permalink

Happy blogging :D

3 – References

[1] vim

[2] VimRepress

Comments