Custom Iterm2 layouts with itermocil
If you frequently work with web development projects, you tend to run a lot of scripts during development. For example, if you are working on a full stack node project you might run
npm run watch and maybe
npm run server. It is usually convenient to run them in different panes in a single tab in Iterm2, so that you can see everything in one place.
Iterm2 lets you save and restore layouts from Preferences but itermocil lets you write YAML files for custom arrangements and relaunch them quickly.
Here is a sample YAML for a simple 2-pane layout.
windows:- name: websiteroot: ~/Dev/websitelayout: even-horizontalpanes:- npm run dev- npm run server
You need to save your custom layouts in
You can launch this layout by running
itermocil <layout-name>#<layout-name> is the filename of the layout file in ~/.itermocil
t so that I can launch any of my custom layouts with
t <layout-name>. This has made it easy to switch between various projects quickly. Now I can start working on my website by just using
t www. A nice side effect is that I no longer have to remember what scripts have to be run to start working on any specific project, I can start hacking on any project with a single command.