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 fullstack 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. It is a hassle to create and arrange these panes every time.
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: website root: ~/Dev/website layout: even-horizontal panes: - 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.
Let me know your thoughts and tips to improve productivity.
Originally posted on https://arjunsajeev.com/writing/custom-iterm2-layouts