My Terminal Workflow

Written by Josh on August 03, 2014

The majority of the time I spend coding, I’m in the terminal. I use OS X’s with tmux to manage my windows, and vim for text editing. I use the bash shell.

While the tools I use are quite common, my configuration for them is somewhat unique. I use the Airline plugin for vim, which gives me a lot of helpful information in the status bar of my editor. I also use the promptline and tmuxline plugins. These hook into Airline, giving me a shell prompt and tmux status bar, configured in my vim settings, that match the colorscheme of my editor.

This article will explain the various settings I use.


The above screenshot is a typical terminal window. (In this case, I’m in vim writing this article.) Along the very bottom is the tmux status bar. This is themed by tmuxline, a vim plugin. When I reconfigure it in my ~/.vimrc, I reload the file, then run :TmuxlineSnapshot! ~/.dotfiles/.tmuxline.tmux.conf, which saves the tmux config file. (This is sourced by my main ~/.tmux.conf.)

The far bottom left has the tmux window ID, which is generally session number:window number. I personally do not use this much.

tmux status-right

The right side, however, contains a bunch of useful information. From left to right, this contains:

  • The current battery level, as output by my tmux-battery script
    • In this screenshot, the battery is discharging and is currently at 93%. A fully charged battery shows a checkmark, and a charging one shows an up arrow.
  • The day of the week, date, and time (%a %Y-%m-%d %l:%M%p in strftime(3) format)
  • The current username
  • The current IP address (getipfortmux)
    • The trailing H means I’m on my home network, so the static IP I have set will work.

The various numbered labels are my windows (what most apps call tabs, tmux calls windows). I always keep a window called “scratch” open (window #1). Then I just open more as needed. I press C-b c to create a new window. This creates a new window in ~/Documents/code/gh, which contains all of my GitHub repos. To edit my website, I would then cd josh<tab>/jo<tab> (this expands to JoshOldenburg/ into the directory, then C-b r and rename the window to, and abbreviated version of the last path component. (The directory is JoshOldenburg because that is the GH user the repo is under. I have other folders for the various organizations I am in, for example, SteinbrennerBlueHats.)

Over time, I end up with many windows. I can use C-b 1 through C-b 9 to switch between the first nine windows by number, but for ten and over I use C-b = and scroll through the list. I do eventually cull the windows, because I can’t possibly need ten windows at once.

I also utilize tmux panes, which are portions of a window with another prompt that I can keep on screen at the same time. For example, in the first screenshot above, I have two panes open. The top one is vim, but on the bottom I have wintersmith running, allowing me to preview this article in a browser.

In this screenshot, I have four panes. The main one, on the left, has vim open, editing a file. The top right has mocha running, waiting for saves to run the tests again. Below that is a small terminal I was using to create and remove directories. Finally, the bottom right is running the server I was working on. I don’t use this many panes frequently, but it is tremendously useful when I need it.

To open new panes, I use C-b % to open a new vertical pane (on the right of the current one), or C-b " to open one below the current pane. These split at 50% and open in the same working directory. I can use C-b <arrows> to move between panes, and C-b M-<arrows> to resize them.


The shell itself is mostly standard, but the prompt is configured using promptline, a vim plugin similar to tmuxline. I set up the prompt in ~/.vimrc, then reload the file and run :PromptlineSnapshot! ~/.dotfiles/

There are two general versions of my prompt:

prompt outside tmux

prompt inside tmux

The first prompt is running outside tmux. The shell pictured is inside my home directory, and is rather uniteresting.

The second prompt is in a shell inside tmux. My tmux status bar has the user and the host in the bottom right, so there is no need for it to be inside the prompt too. The working directory in this case is ~/Documents/code/gh/JoshOldenburg/ It is truncated to the final two path components, in this case JoshOldenburg/, with a leading ellipsis. Next, you can see I am on the “my-terminal-workflow” git branch. The next number signifies I have a job running in the background. I had pressed C-z in vim to hide it temporarily so I could get this screenshot. (fg reopens it. This is a feature of the shell.) If there are no jobs, this is hidden altogether. The final segment, in orange, is the exit code of the previous process. Not pictured here is the battery percentage, which shows up in orange when it falls below 10%.

Having all of this on your prompt is incredibly useful because you have all of that information without needing to type any other commands. The process exit code would previously have required echo $?, and if you type this wrong the code is gone. Seeing the current branch saves me a few keystrokes.

I would mention the contents of my bash_profile, but there is really nothing of interest.


I’m really tired of writing at this point. Here’s my ~/.vimrc.


I called this article “My Terminal Workflow”, but it turned out to be a description of the various symbols and abbreviations and what they mean. This article could certainly use some editing but if I wait longer this will never get published.

Copyright © 2014-2016 Joshua Oldenburg