There is a really cool thing you can do that I started to use and abuse lately.
The idea is simple. I found a cool GitHub repo and I want to check out the code of it in the comfort of my own text editor. I can make that happen in just two clicks.
I have a folder named
~/play in my home directory where I clone different repos I like to play with. I created a macro in Keyboard Maestro that looks like this :
Here is the download of this macro.
It is very simple. This line :
tell application "Safari" to return URL of front document
takes the current URL of my browser (Safari) and puts the URL into my system clipboard. If you use chrome or some other browser, you can check this to change the line to suit your browser.
Then it simply cd’s into my ~
/play folder and
git clones the URL into that folder.
Awesome. Now what can make it even more amazing is if I could instantly open that newly cloned repo without even going to the terminal.
There is a really awesome workflow by Vítor Galvão that lets you watch a folder and present the files of the folder in Alfred. Here is the original workflow that watches over
/Downloads . I modified it to only watch my folder
~/play instead. Here is my modified workflow.
So all together, I find a cool repo, press a button to run my KM macro, it clones the repo to the folder, I press a hotkey to run Vitor’s workflow (the workflow automatically sorts folders by most recent) so all I need is to press return and the folder gets opened in VS Code. You can swap VS Code for an editor you like.