Combining sourceme with tmux is a small workflow improvement which I like to use when running 'complicated' dev setups. By 'complicated" I mean setups where you need multiple terminals to start multiple things.

Let me give you an arbitrary example to give you a sense of what kinds of situations I'm talking about: You often need to run some sorts of Docker containers (for example for the databases) and then some services which you actually develop - let's say a server and a front-end. In such a scenario, there's lots of redundant typing to be done every time you switch to this project:

  1. Start a first terminal
  2. Stop your system database
  3. Run docker-compose
  4. Start a second terminal
  5. Run the back-end server
  6. Start a third terminal
  7. Run the front-end server

Like I said, this is completely arbitrary - there's gazillions other complicated setups out there.

This manual mess can be solved by adding a custom function around tmux into your .sourceme file:

startup () {
  tmux new-session -d 'sudo service postgresql stop; docker-compose up'
  tmux split-window -v 'npm run watch'
  tmux split-window -h 'cd ~/src/200ok/some-service/front-end; npm run start'
  tmux attach-session -d
}

echo "Supported commands: \n"
echo " - startup: Starts tmux, docker-compose, back-end and front-end"

So now I only have to start startup and I get three terminals in one, all already running the right services.