What if there was an easy way to run all of those instantly in tabs and panes?Įnter iterm-workspace: ⚡️ Configuration-based iTerm scripting for instantly starting up your project workspace. Now which commands are you supposed to run? Maybe you have JavaScript compilation, maybe you have a development server, and a job runner, and you're running a Docker database container by hand. You open up your terminal program, cd into the project directory. You arrive at work, turn on your computer, fire up VS Code, and are ready to get developing. I hope these tips about iTerm2 scripts will help you further automate your workflow.Iterm-workspace helps you jump into developing by lowering the barrier to getting started.įrequently, you'll run into a situation where you have to run multiple programs in your terminal to get your project running. I accomplished this by using this command:Īfter opening a new window that you want to start sending text to, remember to grab the current window again by running this: How I decided to organize this for myself was to have five different windows for each of the apps and to have separate panes for each command needed to get each app running inside of the five relevant windows. This allows me to monitor both panes in one iTerm2 window.įor my example case, I need five different apps running. The first pane has Docker running, and the second has the app running. These are commands and zsh shell scripts that I incorporated within TextMate. You’ll notice that, in this script, I use `session.async_split_pane(vertical=true)` to split my current window in two. Just unpack and click on the desired icon(s). Give it a try, and you'll see for yourself. iterm-workspace accepts arbitrarily nested arrays for commands it will recursively split panes to run those commands. Run start-iterm-workspace to launch your workspace Notes As many panes as you want. Then, I send the commands I want for that window like this: Run start-iterm-workspace in your project directory to initialize a configuration file Step by step, develop and test your desired workspace configuration. I prefer to start my script in the current window I’m in, so I start with this: You can script iTerm2 to open new windows and tabs for you. If you wish to do something like this, when creating a script choose “Long-running Daemon” when prompted. iTerm2 allows long-running process.įor my purposes I need to run a command in a terminal window like docker compose-up or make dev and then leave that tab open and running so I can monitor and also run other commands in different tabs and windows. After some experimentation, here are the two most useful features I found. After doing some research, I found that iTerm2 has a Python API that you can use to write some really useful scripts! Here is the documentation I used. I talked to my manager, Joe Chrysler, and he told me I should look into scripting my iTerm2 terminal. I thought maybe I could do something similar so I could just run a single script to get everything set up and running. After doing this arduous process one too many times, I figured there must be a better way.Īt this point, I’d gotten a little experience with bash scripts that we use in our project. I also have to arrange my iTerm2 windows and tabs in a way that makes sense to me each time. I find it hard to remember all the different environment variables I need to set and the different terminal commands required for each app. Getting everything set up correctly can consume a lot of time and lead to frustration. Every once in a while, it is necessary to test something end-to-end with all five apps running locally and pointed at each other. I work on a software project where we currently have five different repositories.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |