Three tools to stay in the zone
So precious are those moments when we, software developers, find ourselves in the flow; yet exiting that state is way too easy. Today I will describe three tools you can use to stay in the zone, to boost your productivity and accomplish more.
What: Mouse-free web surfing.
Why: We all google a lot. It goes like this: search something, scroll the page, click the url bar and refine the search, click on a result, go back, click on another result, etc. Moving our right hand to the mouse and back is simply distracting. Vimium solves the problem giving you shortcuts to navigate among pages, among tabs, and in the history. The ones I use the most are:
f: Shows a label on each link (e.g. AD), typing the label will jump to the page.
<ESC>: Hide the labels shown with
F: Same as f but open the page in a new tab.
H: Go back in history.
L: Go forward in history.
Check out all the commands typing
?. I combine Vimium shortcuts with the
following Chrome shorcuts:
Cmd-1: Shows first tab.
Cmd-2: Shows second tab, similar for other tabs.
Cmd-l: Select url so that you can trigger another search.
Why: I like building my project in the terminal, run script in the terminal, branch in the terminal. I use the terminal a lot. But jumping from one directory to another in a completely different place in the filesystem is a pain. Surely, most of you have probably already mastered:
pushd: Push current directory on the directory stack, change directory.
popd: Remove the top directory from the directory stack and change to it.
cd -: Change to previous directory (last
All these commands are quick ways to move to places relative in time, but what
if we need to go to a folder we haven't been recently in? Autojump comes to
rescue. Autojump keeps a database of the directories from where you usually run
commands. Then, you can jump to a directory with a fuzzy match. Suppose I
often run commands from
~/Desktop/Projects/Android/MyApp. Then I can jump
to it by just running:
What: Move windows around with keyboard.
Why: Ever wanted to have two windows side by side, half of the screen each, and tried to use the mouse to do it? Luckily there is a better way. Meet Hammerspoon. Hammerspoon is an automation tool that binds the OS X api to Lua scripts. Basically you can manipulate windows, the mouse pointer, file systems, batteris, etc. with Lua scripts. In practice, I use it to move windows around with my keyboard.
For example you could assign the combination
Alt-Cmd-left to resize the current window to the left half of the screen and
Ctrl-Alt-Cmd-right to move the window to the monitor on the right. It also can
do a function similar to
f of Vimium but for OS X windows: it shows a label on
each window (also the hidden ones) and you can focus it typing the letters in the
label (see image below). Before Hammerspon I used Spectacle, but it lacks
this labeling/hinting functionality. If you want to try it, a good place to start
is from my
init.lua configuration and tweak it for you needs.
Furthermore, here are some more OS X shortcuts for manipulating windows:
Cmd+tab: Cycle through apps windows.
Cmd+`: Cycle through windows of the same app.
Cmd+H: Hide window.
Cmd+M: Minimize window.
Cmd+tab, select app,
Alt: Show a previous minimized window (
Cmd+tabin this case does not work).