Getting more productive in the command line

I mentioned previously that I changed my Android Studio terminal to Bash.

Since doing that, I’ve been working on making my console more productive as well.

I’ve done 3 main things:

  • Set up a gem to allow me to create pull requests from my terminal
  • Set up some aliases for Bash
  • Set up a ton of aliases for Git

Create pull requests from the terminal:

We use an Atlassian tool chain and part of our process is that everything gets peer reviewed and merged to our main branches through pull requests.

This meant that I had to leave the terminal to create a PR after I pushed code. This will not do! So it made sense to install a tool to do that from the terminal. Atlassian has a good blog post on doing that here:

This was before Atlassian added default reviewers, and having to add my 6 team members every time I had to create a PR was a big part of the reason I went down this rabbit hole. So there was one more thing missing: How do I add the reviewers?

The answer ended up being a function in my Bash config:

This allows me to create a pull request to origin/develop with myself as a reviewer by simply typing: pr develop

Bash setup:

Other than the pr() function in my bash config, I also alias ‘git’ to ‘g’. It might seem a bit silly, but I type git a lot, and I hate typing… It looks like this:

So, the alias bit is obvious. The rest is there so that you can still auto-complete branch names and git commands on ‘tab’.

I keep my config in a gist at:

Git aliases:

I keep a copy of my git config here:

This has been built up from contributions by co-workers, podcast hosts and various random things I found on the internet.

Bonus: Install Cmder

When I’m not in the IDE, my terminal of choice is Cmder

Android Studio – Don’t clear logs after app crash

In Android Studio, the default setting for the Logcat window seems to be “Show only selected Application” (top right corner of the Logcat window)… which is looking at the log of the selected process (your current launch by default). So when your app crashes during testing, that process is gone, so the filter clears the log.

Instead, select “Edit Filter Configuration…” and set up a filter for your app, eg:

  • FilterName: MyApp
  • PackageName: com.example.myapp (<< replace with your app’s package name)

…and then select that filter for future runs. This should keep the log there for you, even after the app crashes.

Android Studio – Set up a custom terminal

In my endless quest to make it unnecessary to leave the IDE, I figured it would make sense to use Git bash as my terminal in Android Studio rather than the default cmd.exe on Windows.

Turns out this is really simple.

1. Open your settings in Android Studio (CTRL-ALT-S) and type ‘terminal’ to find the correct settings.

2. Change the Shell path to Git bash. In my case it was ‘C:\Program Files (x86)\Git\bin\sh.exe –login -i‘. I just  copied this from the start menu shortcut’s properties.

Android Studio Terminal Setup

3. Restart your IDE.

4. Profit. You can bring up the terminal window with ALT-F12, so no need to use the mouse.

Android Studio TerminalOptionally, you can change the console colors in Editor > Colors & Fonts > Console Colors. Just remember to restart your IDE if you change them. If you are on the Darcula theme this is not necessary – everything just works.


Android Studio tips – Mouseless development

I heard somebody making the comment that you can tell an expert by the mastery of their tools. Since I’m a developer (and a pretty good one), I figured it’s time to put in some more effort to master my tools (IDE, VCS, etc).

To this end, I’ve been stalking Hadi Hariri ( for the last few weeks and a couple of things he published has really resonated with me.

My Android Studio setupThe first was an article called No tabs in IntelliJ IDEA, which covers what you would expect – How to use IntelliJ IDEA without tabs. I wrote about my setup based on this here: My Android Studio setup.

This set me on a quest to use my mouse less, which eventually led me to Hadi’s Mouseless Driven Development talk, which is beyond awesome.

These 2 pieces of content has made me both more productive and happier (With my RSI, using a mouse is literally painful).

If you want to be a better developer, ditch the mouse.

My Android studio setup

I figured I’d start documenting some of my setup so that I can keep track of it. Most of this works for IntelliJ as well.

I like dark themes, so I use a modified version of the Darcula theme.

Turn off everything possible

One of the most surprising deviations seems to be the fact that I turn off tabs. They take up screen real-estate and make you either use a mouse or scroll through multiple tabs using keyboard shortcuts to find the one you are interested in.

There’s a great article about it here: No Tabs in IntelliJ IDEA

Editor -> General -> Editor Tabs

Placement: None

I also hide ‘Tool Buttons’ and the ‘Navigation Bar’ in the ‘View’ menu. UPDATE: I now turn off the “Toolbar” as well. I was only using the run button and I can use a keyboard shortcut for that 🙂

This is what you end up with:


The great thing with this set up is that it forces you to use keyboard shortcuts. You can easily get away with CTRL+B to select recent files, CTRL+SHIFT+B for recently edited files and double tapping SHIFT to search for anything.

It sounds counter-intuitive, but this is much faster than trying to find the correct tab in the open ones.

I also hide the Project view (and in fact all tool windows) when I’m not using it (ALT + 1 to turn it on or off quickly) and I’ve set it up to Autoscroll to/from Source so that when I open it the file I was in is selected and if I select a new file, it displays in the editor window:

Android Studio Project View

Change fonts and colors

I find this makes the code more readable.

Editor -> Colors & Fonts -> Font

Primary font: Consolas
Size: 14
Line spacing: 1.1

Font settings

Editor -> Colors & Fonts -> Android Logcat:

  • Assert: #9876AA
  • Debug: #6897BB
  • Error: #FF6B68
  • Info: #6A8759
  • Verbose: #BBBBBB
  • Warning: #BBB529

Android Logcat colors

Set up code styles

I’ve saved a version of my code styles in a github repo with an install script: