Now that we've got all the basics down, it's (finally) time to make a keyboard shortcut of our own, and we are going to start by making a keyboard shortcut for the terminal. I have my terminal set to open up at [command + Shift + ;]. So, let's see how we can get around to doing that.
First, we are going to look up for terminal and see what we get:
If you take a look, you will see that we have three options, and it turns out that they all do the same thing. Now, notice how Terminal pops up in three separate places. This is because the terminal inside PyCharm is in fact two things: one being a bundled plugin and another being a tool. This is why you see Terminal appearing in several places. This Terminal tool can be invoked by both [command + Shift + ;] and [Alt + F12]. Now, I don't really like [Alt + F12], so I am going to get rid of it, by right-clicking (or double-clicking) on the highlighted row:
Now I am assigning a new shortcut by clicking on Add Keyboard Shortcut:
Press [command + Shift + ;] in one go:
If you had another action with the same shortcut, PyCharm will show you conflicts. Now, in my own settings, the conflict lies with the Open Terminal action, which does the same thing, so when the following screenshot pops up, I will choose Leave:
With that, you can now open up your terminal with [command + Shift + ;].
You might have also noticed something else; there was a way to add Second Stroke. This is, in essence, just doing what we did previously, but adding a second stroke. So, say, if we wanted to open up the terminal by pressing [command + Alt + ,] for the first and the second key stroke, this is how we would do it:
So by pressing [command + Alt + ,] twice, you can get the terminal. PyCharm will show up all the possible actions. In this case, the only thing with a second stroke and with this particular first stroke (also known as the Prefix Key) is Terminal.
Making a mouse shortcut is just as easy; you simply click on Add Mouse Shortcut:
Like before, you simply enter the combination of keys that you would like:
You might have also noticed that we have the ability to add an abbreviation; this is a way to quickly find the action in the Search Everywhere action, which is invoked by a double Shift (pressing Shift twice in quick succession). So, say we wanted to add an abbreviation for the Open in Browser action, all we need to do is head over to the Keymap again, right-click on the Open in Browser action, and choose Add Abbreviation:
We would then get a dialog box for the abbreviation:
Once that is done, we should be able to see oib, but in a green tag:
And with that, if we type oib
into our Search Everywhere bar, we get this:
This can be a far better way to do things rather than using a second stroke in a keyboard shortcut. But, abbreviations can be even more powerful than this. We can group a couple of items with the same abbreviation so that we can make our own list of favorite actions that will come up in the Top Hits section of Search Everywhere. Let's have a look.
What we're going to do is assign two abbreviations to each of these two actions:
So, we are going to assign the abbreviation b to both of them, as well as assigning their own unique abbreviations:
As you can see, the two browser actions have one common abbreviation, so we try to look it up in Search Everywhere:
But we can still look them up individually:
This means you can get access to all your favorite actions with just a few keystrokes. This functionality has made me much more productive.