Writing Articles With VIm

Vim is an excellent tool for Developers. It earned it’s reputation for being a Programmer’s Editor. Code is just text — and Vim has a great set of commands for navigating text. Jumping ahead 3 sentences is just as easy as going to the 65th character of the current line. When Vim can’t do something, it can easily use shell commands to manipulate it’s content. Need to sort some table of data? No problem. One of the hardest things to do is to get started with writing.

The blank page is an enemy. To defeat this, I start with a document template. I use simple text file to write all of my blog posts. Then when I’m ready to start a new post, I just copy the template to a new file. This provides me with some structure. I have 4 sections in my template: the Meta section, the Excerpt, the Content, and Notes.

In my Meta section I have 5 fields: Title, Format, Publisher, Created Date, and Publish Date. Every WordPress post should have a custom excerpt. Yes, WordPress can dynamically create an excerpt for you, but you shouldn’t rely upon it. It’s an opportunity to enhance the attractiveness of your content. The Content is by far the biggest section. When I’m just getting started with a post, I’m just typing the ideas I want to express, not really worrying about organization. I like to keep each sentence on it’s own line, as this makes it easier to move around and organize my ideas. When a paragraph feels solid I’ll merge multiple lines together so it feels like a cohesive piece of content. Then as I’m ready to start composing the final article, I’ll start moving things around.

The Final section is Notes. This is where I like to put URL for links to content. I try to put the link text I want to use, next to the URL. As the content section becomes more solid, I like to order the URLs in the order I plan to use them in the content.

When I’m done with my writing, I use some shell commands to help refine my work. The aspell command performs spell check for me. It’s a great UNIX command, as it makes it easy for you to see the context of the word in questions, and makes it easy to act upon it. If you’re a mac user, there’s a great command called say. It takes a piece of text and reads it out loud in a computerized voice. It can be hard to evaluate your own work. You might do a decent job of proofreading your own work. I, however, am not blessed with that skill. When my computer reads it back to me, I tend to catch sentences that looked fine, but read weird. Also, when it comes across a spelling mistake, it sounds “off”. I have my text-to-speech voice set to a British female voice. So it sounds quite nice and posh, when it’s read back to me.

When I’m ready to copy/paste my content into WordPress, I’ll use the seg function. It’s part of my Opal project. What this does is select a range of lines from the middle of a document. If my text document it 60 lines, my article might be lines 19 through 45. In that case, my command might look like the following:

$ seg article 19 45 | pbcopy

The pbcopy command copies the text into my system clipboard. Then I can just paste the article into my WordPress editor. I’d repeat that process for the excerpt. Then all that is left is add the URLs and link text from the Notes section, into the WordPress editor.

How do you write your articles? write a post on your site, and let me know about it.

Sorry, but comments are closed. I hope you enjoyed the article