PyCharm Shortcuts
Last updated: January 18, 2021
These are my PyCharm keyboard shortcuts. Some are customized to map to analogs in Sublime Text; for custom shortcuts I’ve provided the name of the command.
See also this official list of “keyboard shortcuts you cannot miss”.
Table of contents
- Navigation
- Editing code
- Folding & custom regions
- Running
- Testing
- Debugging
- Git integration
- JIRA integration
Navigation
- Open “Run” tab:
cmd-4 - Open “Debug” tab:
cmd-5 - Navigate from “Run” panel (or other panels) back to main editor window:
esc - Quickly toggling between two open files:
ctrl-backtick(the “`” character; this activates “Switcher” for a split second) - Quickly open a file:
cmd-t - Jump to class/method (any symbol, really):
cmd-shift-r - Run command:
cmd-shift-p - Show definition of symbol under cursor:
cmd-y Jump to a method in the currently open file (Navigate > File Structure):
cmd-r
- Note that you can type to filter this list
Navigate recently open files and other panels:
cmd-e
Navigate to anything: double-press
shift
Editing code
- Cyclic expand word (auto-completes anything):
alt-/
Folding & custom regions
- Use
# region Description hereand# endregionto denote regions in large files - Jump to custom region:
cmd-alt-.(this shows a pop-up list of all the custom regions in the current file) - Fold custom region under cursor:
cmd-. - Fold method under cursor:
cmd--(that’s command-minus) - Unfold method under cursor:
cmd-+
Running
- “Run…” quick run modal:
ctrl-alt-r- Then
enterto run - Or
shift+enterto debug
- Then
Testing
- Run test method/class under cursor:
ctrl-shift-r - Debug test method/class under cursor:
ctrl-shift-d
Debugging
- Add breakpoint:
cmd-\ - Evaluate selected code:
cmd-; - Quick evaluate selected code:
cmd-shift-;
Git integration
ctrl-vbrings up the VCS menu, but I’ve overridden this with my own custom quick list
When using the commit, push, etc. dialogs,
ctrl-enterwill execute the action from the keyboard.I’ve mapped
cmd-ctrl-shift-↑andcmd-ctrl-shift-↓to Next/Previous Change so I can quickly navigate between changes when using the various diff views.Using the “Compare with the Same Repository Version” menu item allows you to diff uncommitted changes for the open file.
- This compares with what’s in
HEADvs. “Compare with the latest repository version”, which compares with what the latest version of the file is on the remote - To revert chunks in the diff view, click the
>>(“accept” button) in the gutter.
- This compares with what’s in
You can make JIRA issue numbers in git commit messages hyperlinks. Search for “JIRA” in the preferences to find where to do this.