---
title: Set Your Mouse Free
teaser:
tags: vim,osx,unix
author: Tristan Dunn
published_on: 2010-11-04
---

Seeing that I refuse to be tied down by the shackles of corded peripherals, I
use an Apple Wireless Keyboard and Magic Mouse. Unfortunately we had an issue
with our rechargeable batteries this week and I was left without a functioning
mouse. Rather than go buy more batteries I decided to try to get by with just my
keyboard, which worked out surprisingly well.

### Editing

We've mentioned it
[several](https://thoughtbot.com/blog/post/619330025/viiiiiiiiiiiiiiiiiim)
[times](https://thoughtbot.com/blog/post/166073596/intro-rails-vim) before, but
we almost exclusively use vim now. It had a bit of a learning curve in the
beginning, but substantially sped up my coding and made it a lot easier to
transition away from a mouse.

> Learning keyboard shortcuts is always worth the time and initial pain. &#8212;
> [John Nunemaker](http://twitter.com/#!/jnunemaker/status/29631490117)

If you're just starting out, It helps a lot if you pair program with people who
already use vim. If not,
[vimtutor](http://linuxcommand.org/man_pages/vimtutor1.html) can be helpful in
learning the basics. [Unbinding the arrow
keys](http://chris-lamb.co.uk/2008/12/30/kicking-vim-cursor-key-habit/) can also
be a huge help with switching to `hjkl`, but super annoying the first day or
two. We also highly recommended you bind Caps Lock to Control to save your
fingers some trouble.

### Browsing

If you are using vim then odds are you don't use your mouse for the majority of
the day already. If you use Chrome as your default browser you should most
definitely be using the [Vimium
extension](http://chrome.google.com/extensions/detail/dbepggeogbaibhgnhhndojpepiihcmeb),
which brings keyboard shortcuts to Chrome in the spirit of vim. (If you're using
Firefox try [Vimperator](http://vimperator.org/vimperator).)

Apart from the obvious scrolling, history and tab shortcuts is the incredibly
useful link hints mode. Hitting `f` in command mode labels each visible link
with a set of letters, which can be pressed to follow the link. There's also
commands for opening one or multiple in new tabs. (Press `?` after installing to
see all the commands.)

![''](http://i53.tinypic.com/r24z78.png)

![''](http://i52.tinypic.com/166ken8.png)

Note that you'll probably want to disable Vimium on sites that already have
keyboard shortcuts, such as GMail.

### Organizing Windows

It'd be pretty annoying not having a mouse if you couldn't move windows around
with the keyboard. There are several applications that assist with this, but my
personal favorite is [Divvy](http://www.mizage.com/divvy/). You can achieve the
same movements as most other applications, but get the advantage of being able
to define your own positions as well as custom shortcuts. If you're on BSD/Linux
check out [xmonad](http://xmonad.org/).

If you spend your day between terminal and vim,
[tmux](http://tmux.sourceforge.net/) is a good way to combine them into a single
screen. It's also great for remote pairing.

### Opening Applications, Files and Folders

![''](http://smokingapples.com/wp-content/uploads/2009/01/apple-keyboard-shortcuts-guide.jpg)

I have my dock hidden and at the smallest size possible, since it's not easy to
completely remove it. OS X comes with Spotlight built-in, but tools like
[Quicksilver](http://www.blacktree.com/) and [Alfred](http://www.alfredapp.com/)
are substantially faster and allow for much more complex commands.

On the rare occasion when I need to use Finder, Joe Ferris informed me that you
can open files and folders with &#8984;+&#8595; and go up a directory with
&#8984;+&#8593;.

### Caveats

By default OS X only allows you to tab between text boxes and lists, which is
not that helpful. You can change this to all controls in the Keyboard
preferences, or by pressing `Control+F7`.

There are still occasionally dialogs or other functions that can't be access via
keyboard, especially in third-party applications. For these rare cases I've been
using my laptop trackpad. If your mouse is still working try leaving it just far
enough away to make it annoying to use unless you really need it.

What applications do you recommend to make it easier to stop using the mouse?
