There are a few projects I have where I need to work from two separate directories simultaneously, and while there are a number of ways I could set up workspaces in various esoteric IDEs or terminal session managers, I am stodgy in my ways and enjoy using the built-in Terminal in macOS for most things. If you use iTerm on the Mac, the commands are similar, but the AppleScript events that I use may need to be adjusted.
But I'm getting ahead of myself. For these projects, I want to have a bash/zsh alias that does the following:
- When I type
xyz(alias) and hit 'return'
- Open the current tab to path
- Open a new tab next to this tab
- Change directories in then new tab to path
Simple enough, you say, but I found that a number of AppleScript incantations (e.g.
do script and the like) could not be made to work with bash aliases easily. In the end, I put the following in my
.zshrc file (see all of geerlingguy's dotfiles here—some private aliases excluded):