Dzmitry Kavalionak
Sep 3, 2018 · 2 min read

Save your dev time navigating between your projects at lightning speed

When I started my Ruby on Rails dev career I usually worked on a single project. Now I need to work on two or more projects at once. And switching between them in the console quickly became a bit of a pain…

Two years ago I started looking at a possible solutions for my problem. First I set up my Mac to start the shell automatically after login. You can configure it under System Preferences > Users & Groups

My goal was to set up the shell so it will automatically open the last project I was working on. Or when I open a new terminal window or tab. The first idea was to save current project name into an ENV variable. But after restart system cleans all the user ENV variables so this idea didn’t work. The second idea was to save project name into a hidden file in my home folder. After wrapping this idea into a bash function I came up with this solution:

It looks fairly simple but it helps me a lot in my everyday development cycle! Every time I need to switch the project I hit Ctrl+R, type workon and several letters of the project name and hit Enter.

The second benefit of this function is that my terminal boots within the last project I was working on — handful!

You can try to use this trick in your development cycle too. Just copy and paste this code into your bash profile. Please tell me your thoughts about this solution in the comments below

Happy coding!

Update:

To make navigating between projects even faster I aliased workon to goto. Now to start working on capybara-click_at I type go then Ctrl+R until I see goto capybara-click_at and hit Enter

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade