Writing wordpress posts in Vim?

Writing wordpress posts in Vim?

Initially I installed Linux for some weird reasons; I wanted to learn the command line interface (CLI), I wanted to use secure shell (SSH), hang out on IRC with weechat in tmux, and a few other things. Really simple, and in the beginning it was really counterintuitive to install Arch Linux to be able to do those kind of things. It was a rough beginning but it didn’t take long before I got tired of connecting to IRC and I only had a raspberry pi which I could ssh into. However, all the stuff I learned seemed really simple – if you knew what you were doing, and I didn’t. So, why not blog about it? My main reason was, that it would be easier to remember, and I would need to get more background knowledge about the stuff I was doing instead of just hustling my way through making stuff work. A friend of mine suggested she could help me set up a wordpress page. Awesome. However, I didn’t really know what I should write about and therefore, the page just idled for a long time. I got the idea that I wanted to write an Arch Linux Install Guide, and I started writing it through a wordpress-page. It didn’t take long before I was really annoyed with the way my workflow was inhibited by the setup of the page. While writing the Arch Linux Guide, I started to get interested in Vim. It looked like such a cool text editor and as I have written before, Luke Smith has been a great inspiration and has a bunch of videos about writing LaTeX documents in Vim. I was intrigued. I knew that there was a somewhat wast amount of plugins for Vim. Maybe there was one for wordpress?

Google came through beautifully and quickly led me to VimPress, a quite cool plugin for Vim which supported writing posts in WordPress – cool.

Oh.. You haven’t used plugins before? Me neither and this also raised quite a lot of question. However, it is, as much else, really simple. First you need to install a plugin-manager for Vim. I use Vundle, but not sure if other managers would be better? Never mind. Look at Vundles github. It has 5 easy steps to install Vundle, but if you think it’s too complicated then first clone the plugin (make sure you have git installed).
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

then open your .vimrc
vim .vimrc

Here you need to add the following lines
set nocompatible
" #Settings
set rtp+=~/.vim/bundle/Vundle.vim
" #Filetype
filetype off
filetype plugin indent on
" #Plugins
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
call vundle#end()

You should note a pattern here. Settings at the top and plugins near the bottom. Now, plugins/bundles are really easy to install with Vundle because you can paste users/plugins from Github. Cool right! Therefore, the github-page of which I spoke earlier is from a guy called Daniel – all you need to do is copy this “danielmiessler/VimBlog” and paste it instead of “paste the plugin here”. Easy as pie. Now start vim and run the following command

Vundle will start installing the Vimpress plugin. But we also need to setup a config for wordpress. So, you need to create a file with url/user/pass in your home directory
vim .vimpressrc

Now add the following
blog_url = www.the-url-for-your-blog.com
username = your-user
password = your-password

Yeah, I know the password is in cleartext. However, I haven’t found any nice solution for passwords in Linux in general. Back to vim – all you need to do is start vim and type
BlogList # List your posts
BlogNew # Make a new post
BlogSave # Save your current work

There are other commands, but I like to read my blogs a last time on the wordpress-page before posting. sometimes there have been some inconsistencies between Vim and wordpress. However all my posts have been written in Vim with this plugin. If you like to blog and you want to be better with Vim, then I can’t recommend this enough.

You’ve made it to the end.