Configuring keyboard shortcuts
PyCharm includes several predefined keymaps and lets you customize frequently used shortcuts.
To view the keymap configuration, open the Settings/Preferences dialog Ctrl+Alt+S and select Keymap.
PyCharm automatically suggests a predefined keymap based on your environment. Make sure that it matches the OS you are using or select the one that matches shortcuts from another IDE or editor you are used to (for example, Emacs).
You cannot change predefined keymaps. When you modify any shortcut, PyCharm creates a copy of the currently selected keymap, which you can configure. Click to duplicate the selected keymap, rename, remove, or restore it to default values.
The keymap itself is a list of actions with corresponding keyboard and mouse shortcuts, and abbreviations. To find an action by name, type it in the search field. If you know the shortcut of an action, click and press the key combination in the Find Shortcut dialog.
Add a keyboard shortcut
On the Keymap page of the Settings/Preferences dialog Ctrl+Alt+S, right-click an action and select Add Keyboard Shortcut.
In the Keyboard Shortcut dialog, press the necessary key combination.
(Optional) Select the Second Stroke checkbox to define a complex shortcut with two sequential key combinations.
Click OK to save the shortcut.
The key combination that you press is displayed in the Keyboard Shortcut dialog, as well as a warning if it conflicts with existing shortcuts.
Add a mouse shortcut
On the Keymap page of the Settings/Preferences dialog Ctrl+Alt+S, right-click an action and select Add Mouse Shortcut.
In the Mouse Shortcut dialog, move the mouse pointer to the central area and click or scroll as necessary.
Click OK to save the shortcut.
The performed mouse manipulations are displayed in the Mouse Shortcut dialog, as well as a warning if it conflicts with existing shortcuts.
Add an abbreviation
An abbreviation can be used to quickly find an action without a shortcut. For example, you can press Ctrl+Shift+A and type the name of the Jump to Colors and Fonts action to quickly modify the color and font settings of the element under the current caret position. If you assign an abbreviation for this action (like JCF), you can then type it instead of the full action name.
On the Keymap page of the Settings/Preferences dialog Ctrl+Alt+S, right-click an action and select Add Abbreviation.
In the Abbreviation dialog, type the desired abbreviation and click OK.
Reset action shortcuts to default
If you changed, added, or removed a shortcut for an action, you can reset it to the initial configuration.
On the Keymap page of the Settings/Preferences dialog Ctrl+Alt+S, right-click an action and select Reset Shortcuts.
Location of user-defined keymaps
All user-defined keymaps are stored in separate configuration files under the keymaps subdirectory in the PyCharm configuration directory:
- ~/Library/Application Support/JetBrains/<product><version>/keymaps
- ~/Library/Application Support/JetBrains/PyCharm2020.1/keymaps
Each keymap file contains only the differences relative to the parent keymap.
You can use these files to share your custom keymaps with team members or between your IDE instances. Copy the corresponding keymap file and put it in the keymaps directory on another PyCharm installation.
Conflicts with global OS shortcuts
Predefined keymaps do not cover every possible platform, version, and configuration. Some shortcuts can conflict with global system actions and shortcuts for third-party software. To fix these conflicts, you can reassign or disable the conflicting shortcut.
PyCharm detects the conflicts and notifies you with a popup message:
Click Modify shortcuts to open the Keymap settings dialog where you can make the necessary adjustments:
Find below a few examples of the known shortcut conflicts for macOS and Ubuntu. We also recommend checking that function keys are enabled on your system.
|OS||Shortcut||System action||PyCharm action (default keymap)|
|macOS||⌃Space||Select the previous input source||Basic code completion|
|Ctrl+Shift+A||Search man Page Index in Terminal||Find Action|
|Ctrl+Click and drag||Right-click||Copy and drag selected text|
|Ctrl+Alt+L||Lock screen||Reformat Code|
|Ctrl+Alt+T||Launch Terminal||Surround With|
|Ctrl+Alt+F12||Open the tty12 virtual console||File path|
|Switch between Workspaces||Undo/redo navigation operations|
|Alt+F7||Move window||Find Usages|
|Alt+F8||Resize window||Evaluate Expression|