My First Post With VimRepress

May 25

My First Post With VimRepress

First Post With VimRepress

Using VimRepress you can write your WordPress content in Vim (or MacVim) using Markdown syntax and post the content directly to your WordPress site without ever leaving Vim.

Read More

Append text to lines in Vim

Mar 01

Append text to lines in Vim

Every time someone shows me something they like about some other editor it is always fun to show how the same thing can be done in vim. A popular thing in modern editors now seems to be multiple cursors and folks get excited about appending some text to a bunch of lines all at the same time.

Suppose you have a bunch of lines that you want to turn into an unordered list in HTML. Here is a quick and easy way to add something to the end of a line in vim.

  1. Select the lines you want to work with
  2. norm (type the following commands)
  3. A</li> (the string you want to append to the lines)

If you visually select the lines you want to work with, the full command might look something like this.

And that will take your from code that looks like this:

To code that looks like this:

Read More

Sublime Text 2 Commands For Mac

Dec 21

Sublime Text 2 Commands For Mac

Sublime Text 2 is a really nice text editor with a lot of power behind it. It also has a “Vintage” mode for folks who fancy vim, such as myself. I also happen to enjoy exploring new software, especially text editors, and Sublime Text 2 is my current favorite text editor. The only majorly annoying thing about Sublime Text 2 is the way it handles word wrapping. Periods (.) can sometimes wrap to the next line making it look like you have a mistake in your writing. This is only a problem when writing paragraphs, like in Markdown for blog posts.

Not all of the keyboard commands listed in the standard documentation map on to Mac OS X all that well. Below is a list of the keyboard shortcuts to various commands for Mac OS X.

This list is also available on github.

Read More

PHP vs Ruby :: 2012 Year End Review

Nov 03

PHP vs Ruby :: 2012 Year End Review

Back in 2007 I wrote an article titled PHP vs Ruby – Practical Language Differences which drew a fair amount of attention. Now that I’ve been working with Ruby in much more depth and both PHP and Ruby have matured dramatically over the past five years it is time to reevaluate the comparison.

Read More

Run PHP Script in Vim

Aug 17

Run PHP Script in Vim

When developing PHP apps I often want to run the current file and see the results. Sometimes I even want to save those results, or perhaps manipulate the results. So I wrote this little vim function to run my currently open PHP file and place the results in a new VIm buffer.

Read More

My Favorite Vim Tips

Aug 16

My Favorite Vim Tips

Here are some of my favorite tips for working in Vim. I use MacVim but everything below should apply to any version of Vim you are using. Vim is such an amazingly powerful editor you can use it for years and still learn new stuff all the time. This is a small collection of features I use most often and find most helpful. Hopefully they will be helpful to you as well.

Read More

camelCase to snake_case

Jun 15

camelCase to snake_case

Here is a TextMate command that will convert all of the selected text from camelCase to snake_case. This command is specifically designed for PHP. Thanks to PHP not having namespaces (until recently) many developers use PEAR naming conventions resulting in code that has class names like BP_Common::fancy_function(). This command will not convert the BP_Common.

Read More