Easy Project Switching With Itermocil + Command Line Shortcuts
I often need to switch between multiple projects, or maybe I’m just getting started for the day. Spending time booting up these project environments is a waste.
These steps assume you use Mac, iTerm2, and VSCode
First install Itermocil for pre-configured layouts and commands saved in .yml files.
$ brew update && brew install TomAnthony/brews/itermocil
$ mkdir ~/.itermocil && touch ~/.itermocil/projectname.yml && open ~/.itermocil/projectname.yml
Paste in this layout:
- name: projectname
- npm run start
- git status
You can test this by typing “itermocil projectname” in iTerm2.
Command Line Shortcuts
To make this process even faster (9 keystrokes faster) setup an alias for each of your layouts.
$ echo 'alias projectname = "itermocil projectname"'>>~/.bash_profile
$ source ~/.bash_profile
You could take this a step further by opening VS Code to your project directory as part of the same alias.
Add `code` to your shell by following these steps (These are Mac instructions, check the link for other platforms):
1. Open VS Code
2. Press `F1` and search “shell”
3. Click on `Shell Command: Install ‘code’ command in PATH`
Now update your alias:
alias projectname = "itermocil projectname && code path/to/project/dir"