Ben Crowder / Code

Vim Blog

Vim Blog is a Vim plugin for posting to a WordPress blog. It also includes a standalone Python script for doing so from the command line. It’s based off the vim-blog code.

Code

http://github.com/bencrowder/vimblog

Installation

Edit vimblog.vim and replace the username, password, and blog URL with your own. Then move vimblog.vim into your ~/.vim/plugins directory. (Add the directory if it doesn’t already exist.)

Usage

The first line of the file will be the blog title. Leave a blank line under the title. Everything after that (line 3 to the end) will become the body of the post.

When you’re ready to post, type ‘:Post’ and hit enter.

If you want WordPress to automatically publish your post, set publish = 1 in the script.

Standalone Python script

To use the Python script, edit postblog.py to add your username, password, and URL. Move it somewhere in your path, then run it on the file you’d like to post:

python postblog.py myblogpost.md

Alternately, you can use the Bash shell script included (“post”). Move it to somewhere in your path and edit it to fit your system. It assumes you’re in a “drafts” directory and will automatically move the posted file to the “posted” directory parallel. In other words, it expects your directory structure to look like this:

blog/
    drafts/     mypost.md, newdraftpost.md, etc.
    posted/     alreadyposted.md, etc.

You write your post in the drafts/ directory, run “post myfile.md”, and it’ll move your post to ../posted.