January 2012

26 Jan

(Re)Mapping Command-Shift-Arrow Keys in Janus/MacVIM

in janus, mac, vi, vim

Users of the Janus VIM suite may notice a change in the newest version of Janus. In previous versions, one could navigate around split panes (including to and from the file browser) by holding down COMMAND-SHIFT and then typing one of the arrow keys. This feature has been removed from the latest versions of Janus (I'm guessing because of some other conflict).

Here's how to add that back in.

  1. Open your ~/.vimrc.after file.
  2. Add the code shown below.
  3. Save and restart VIM.
25 Jan

Atoum: A Different Unit Testing Framework for PHP

in php, phpunit, programming, testing

For a long time, it has seemed that when it comes to unit testing in PHP, there is only one game in town: PHPUnit. And in all fairness, it's popularity is justified. It is a good framework, and can generally handle standard use cases.

But recently I found Atoum. Not being one to start small, I began using it on a large (soon to be Open Source) project that I was writing from scratch.

Was it love or infatuation?

Atoum has some great out-of-the-box features:

  • Support for PHP namespaces.
  • Each test can be run directly.
  • The CLI output is clean and intuitive.
  • I love the method chaining support.

VIM with different theme

VIM with different theme
19 Jan

Janus VIM on Linux Mint

in janus, linux, linuxmint, vi, vim

VIM with JanusVIM with JanusLinux Mint claims to be the second most popular Linux distribution after Ubuntu. And it is largely based on Ubuntu/Debian. While there are many subtle differences, though, the main one is that Mint supports a broader range of desktop environments -- most notably, Gnome 3.

Janus is a package of tools that turn vanilla VIM into a powerful development environment. It is targeted at GUI versions (gvim and MacVim), and it comes with a large assortment of VIM plugins and scripts.

This short blog shows how to install Janus on a newly installed Linux Mint desktop. It assumes that you can run commands using sudo in a terminal.

VIM with Janus

VIM with Janus
10 Jan

Git drupal:// URLs for projects and sandboxes

in drupal, git

In a previous post, I showed an example of cloning a module that included this command: git clone drupal://drupalcs. But I neglected to explain how this worked. I'm not sure where I picked this up (it was probably from Sam Boyer), but by adding a few lines to your ~/.gitconfig makes checking out Drupal projects and sandboxes easier:

[url "ssh://git@git.drupal.org/project/"]
    insteadOf = "drupal:"
[url "ssh://git@git.drupal.org/sandbox/"]
    insteadOf = "drupalsand:"

This allows you to use drupal://PROJECT_NAME to identify a project (module, theme) git repository, and drupalsand://USER/NID to checkout a sandbox. For example, I can clone one of my sandbox projects with this command, executed at the command line:

$ git clone drupalsand://mbutcher/1356522
Cloning into 1356522...
remote: Counting objects: 988, done.
remote: Compressing objects: 100% (466/466), done.
remote: Total 988 (delta 463), reused 878 (delta 404)
Receiving objects: 100% (988/988), 242.04 KiB | 354 KiB/s, done.
Resolving deltas: 100% (463/463), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.

Perhaps this sort of syntactic sugar isn't for everyone, but I find it to be a nice configuration short-cut.

10 Jan

Syntax Checking for Drupal in VIM

in drupal, php, phpcs, programming, vi, vim

SyntasticSyntasticVim (VI Improved) is a powerful text editor that comes standard on most versions of Linux, OS X, BSD, and other UNIXes. With thousands of add-ons, console and GUI versions, and a fully scriptable environment, you can transform a humble text editor into a powerful development tool. In fact, there are several Drupal add-ons for vim.

In this article, I explain how to turn on syntax checking for PHP, adding code style validation along with error checking. We do this with three tools: The Syntastic Vim plugin, the PHP CodeSniffer PEAR package, and the Drupal Code Sniffer project from Drupal.org.

Syntastic

Syntastic