Composer: Globally install phpunit + optional dependencies

This is a quick one for myself. Copy/Paste instructions on how to install PHPUnit + optional dependencies via composer.

This installs 3.7.* as that’s what we use, bit just drop the = onwards to install the latest version

composer global require 'phpunit/phpunit=3.7.*'
composer global require 'phpunit/php-invoker'
composer global require 'phpunit/dbunit'
composer global require 'phpunit/phpunit-selenium'
composer global require 'phpunit/phpunit-story'

Introduction to vimrunner-python

Note: I’d advise installing python libraries via virtualenv

I wanted to try out vimrunner-python but the only docs available are more API docs than usable documentation.

Here’s a 60 second guide to getting it running:

Make sure your install of vim supports clientserver:

[[ -n "`vim --version | grep client`" ]] && echo "Installed" || echo "Not installed"

If it doesn’t, read this post

Once it does, start an instance of vim in server mode:

vim --servername this_is_our_name

Create a python file with the following contents to talk to it:

import vimrunner

s = vimrunner.Server("this_is_our_name")
# initialize vim server
client = vimrunner.vimrunner.Client(s)

client.type("IHelloWorld<esc>");

Run the python file, see the words appear.

Useful functions

I used client.type() to send raw commands to the vim instance, but vimrunner-python provides a few useful abstractions.

  • client.insert(“Hello World”) – Will insert “Hello World” at the current location and leave you in insert mode
  • client.normal(“dd”) – Will send “dd” in normal mode, cutting the current line into a buffer

Installing vim with clientserver

To use vimrunner, your installation of Vim needs to be compiled with clientserver support.

To check if your vim installation has it already

[[ -n "`vim --version | grep client`" ]] && echo "Installed" || echo "Not installed"

If it does, you don’t need the rest of the psot

To do this, follow these instructions:

hg clone https://vim.googlecode.com/hg/ /tmp/vim
cd /tmp/vim
./configure --with-features=huge--enable-gui=auto
make
sudo make install

Open a new terminal and run the command above again to see if clientserver is there. If it isn’t, you might need some dev dependencies installed.

Ubuntu/Debian:

sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev

Fedora/Redhat:

sudo yum install libXt.i686 libXt-devel.i686 \
libXpm.i686 libXpm-devel.i686 \
libX11.i686 libX11-common.noarch libX11-devel.i686 \
ghc-cairo-devel.i686  cairo.i686   \
libgnomeui-devel.i686 \
ncurses.i686 ncurses-devel.i686  ncurses-libs.i686 ncurses-static.i686 \
ghc-gtk-devel.i686 gtk+-devel.i686 \
gtk2.i686  gtk2-devel.i686 \
atk-devel.i686 atk.i686 \
libbonoboui.i686 libbonoboui-devel.i686