Android Studio Tips & Tricks — Cont.

Customising Keymapping

Yossi Elkrief
4 min readAug 21, 2016

Last time, we started exploring Android studio.
As i’ve mentioned, during my consulting visits i see different approaches on how to use Android Studio (AS) and i think it’s important to have some important key aspects on how to use AS and how it can be more productive than using a mouse for instance…

Before we go and change any Key mapping , Let’s go over and review which groups of Key mapping we have.

Keymap groups

Keymaps groups Android Studio

Keymap groups include the followings :

  • Editor Actions — All the actions you can do within your Code Editor that are not code related, such as : Delete Line, Join Lines etc.
  • Main menu — All the actions you can perform from the Main menu/toolbar options such as : Cut, Copy, Paste etc.
Main menu options/actions on Android studio
  • External Tools — 3rd-party standalone applications : code generators and analyzers, pre- and post- processors, database utilities, etc. Shortcuts here are is in fact for the tools defined on Tools page in the preferences.
    File > Settings > Tools >External Tools for Windows and Linux
    AS > Preferences > Tools > External Tools for OS X
  • Version Control Systems — Anyone (Almost) is using some sort of Version control system for maintaining code, versions and tracking changes.
    The key mapping here are quite extended and has CVS, GIT, SVN, Mercurial etc. related options.
Version control system key mapping options
  • External Build Systems — Here we can see Gradle (as an example for External Build system with integration to AS) .
    Gradle tasks and assign them a specific shortcut and run them.
  • Debugger Actions — AS has Java so we will see JavaDebuggerActions as a possible keymap we can allocate.
  • Macros — Macros are a way to automate repetitive tasks you do frequently while writing code. so here you will be able to assign keymap shortcut for each Macro you have.
  • Quick Lists — A Quick List is a pop-up menu with commands, configured by you/3rd party plugin/addon which can be associated with a keyboard or mouse shortcut.
  • Plug-ins — A list of actions enabled by your currently installed set of plug-ins where you can assign them a shortcut to be used later…
  • Others — Basically a list of all the rest.

Searching is a great start :)

Android Studio has great search feature, you can search within the Keymap screen and if you don’t remember the exact naming, all the available options will show up.

Search example in Android studio KeyMap window.

Customising Keymapping

Now, after we know how to see our Keymappings, why don’t we give it a try and change one that we need to use.
Customising keymap will give us the chance to use less keys/use keys that are more comfortable for us while we code/easy to remember later on :)

Let’s say for example i want to assign a keymap shortcut to build variants

Build variants search within keymap screen

Here you can see i’ve searched for the option (shown under Other) and when you right click you will get three options :

  1. Add keyboard shortcut
  2. Add mouse shortcut
  3. Add Abbreviation — This needs some simple explaining. Remember i was talking about the cool search feature within Android studio? well, Search is everywhere >:D and can be triggered via a simple keyboard shortcut. You use abbreviation added in keymap for quick search an action.

Now we have assigned an abbreviation we can use it in search

Example for build variants abbreviation

To search everywhere, follow these steps

Do one of the following:

  • Click the magnifying glass in the upper-right corner of the AS window.
  • Double-press Shift

Next up, some more cool info about Android Studio.

--

--