PyCharm should be one of the most commonly used Python editors. Today, I have compiled a PyCharm shortcut key encyclopedia, including Mac and Windows versions. It is recommended to save it for later use.
Shortcut keys for Mac
Symbol Description
- ⌘ Command
- ⇧ Shift
- ⌥ Option
- ⌃ Control
- ↩︎ Return/Enter
- ⌫ Delete
- ⌦ Forward delete key (Fn+Delete)
- ↑ up arrow
- ↓ down arrow
- ← Left arrow
- → Right arrow
- ⇞ Page Up(Fn+↑)
- ⇟ Page Down(Fn+↓)
- Home Fn + ←
- End Fn + →
- ⇥ Right tab (Tab key)
- ⇤ Left Tab (Shift+Tab)
- ⎋ Escape (Esc)
edit
- ⌃Space basic code completion (complete any class, method, variable)
- ⌃⇧Space smart code completion (list of filter methods and expected types of variables)
- ⌘⇧↩ automatically end the code, automatically add a semicolon at the end of the line
- ⌘P Display method parameter information
- ⌃J Mid. button click to quickly view documents
- ⇧F1 View external documents (on some codes, it will trigger to open the browser to display related documents)
- ⌘+ Mouse over the code to display the brief information of the code
- ⌘F1 Display specific description information at the error or warning
- ⌘N, ⌃↩, ⌃N Generate code (getter, setter, constructor, hashCode/equals, toString)
- ⌃O Override method (override parent class method)
- ⌃I Implementation method (implement method in interface)
- ⌘⌥T surround code (use if..else, try..catch, for, synchronized, etc. to surround the selected code)
- ⌘/ comment/uncomment and line comment
- ⌘⌥/Comment/Uncomment and block comment
- ⌥↑ Continuously select code blocks
- ⌥↓ Reduce the currently selected code block
- ⌃⇧Q Display contextual information
- ⌥↩ Show intention actions and quick fix codes
- ⌘⌥L format code
- ⌃⌥O optimize import
- ⌃⌥I Automatic indent line
- ⇥ / ⇧⇥ Indented code / Unindented code
- ⌘X Cut current line or selected block to clipboard
- ⌘C Copy the current line or selected block to the clipboard
- ⌘V Paste from clipboard
- ⌘⇧V Paste from the nearest buffer
- ⌘D Copy the current line or selected block
- ⌘⌫ Delete the current line or the selected block line
- ⌃⇧J Smartly splice the code into one line
- ⌘↩ Smart split and spliced rows
- ⇧↩ start a new line
- ⌘⇧U case switch
- ⌘⇧] / ⌘⇧[ select until the end/start of the code block
- ⌥⌦ Delete to the end of the word (⌦ key is Fn+Delete)
- ⌥⌫ Delete to the beginning of the word
- ⌘+ / ⌘- expand/collapse code block
- ⌘⇧+ expand so the code block
- ⌘⇧- Collapse all code blocks
- ⌘W Close the active editor tab
Query/replace
- Double ⇧ query anything
- ⌘F Search in file
- ⌘G In search mode, search down
- ⌘⇧G In search mode, search upwards
- ⌘R file replacement
- ⌘⇧F Global search (according to path)
- ⌘⇧R global replacement (according to path)
- ⌥F7 / ⌘F7 Find usage in file/ Find usage in class
- ⌘⇧F7 highlighted usage in the file
- ⌘⌥F7 display usage
- ⌘⇧S Query structure (only for Ultimate Edition version, need to be set in Keymap)
- ⌘⇧M Replacement structure (Special for Ultimate Edition version, need to be set in Keymap)
Compile/run
- ⌘F9 Compile Project
- ⌘⇧F9 Compile the selected file, package or module
- ⌃⌥R Pop up the selectable menu of Run
- ⌃⌥D pop-up Debug selectable menu
- ⌃R run
- ⌃D debugging
- ⌃⇧R, ⌃⇧D Run context environment configuration from editor
debugging
- F8 Go to the next step, if the current line breakpoint is a method, it will not enter the current method body
- F7 Go to the next step, if the current line breakpoint is a method, then enter the current method body, if the method body has a method, it will not enter the embedded method
- ⇧F7 Smart step in, there are multiple method calls on the line where the breakpoint is located, which method will pop up to enter
- ⇧F8 jump out
- ⌥F9 runs to the cursor, if there is another breakpoint before the cursor, it will enter the breakpoint
- ⌥F8 calculation expression (variable value can be changed to make it effective)
- ⌘⌥R Resume the program, if there is a breakpoint in the code below the breakpoint, it will stop at the next breakpoint
- ⌘F8 Switch breakpoint (if the cursor has a breakpoint in the current line, cancel the breakpoint, if not, add a breakpoint)
- ⌘⇧F8 View breakpoint information
navigation
- ⌘O Find class files
- ⌘⇧O Find all types of files, open files, and open directories. To open a directory, you need to add a backslash/ before or after the input.
- ⌘⌥O Go to the specified variable/method
- ⌃← / ⌃→ Switch the open edit tab page left and right
- F12 Return to the previous tool window
- ⎋ Enter the code file window from the tool window
- ⇧⎋ Hide the current or last active window, and the cursor enters the code file window
- ⌘⇧F4 Close activity run/messages/find/… tab
- ⌘L Jump to the specified place of a certain line in the current file
- ⌘E Display the record list of recently opened files
- ⌘⌥← / ⌘⌥→ Back/forward to the previous operation
- ⌘⇧⌫ Jump to the last edited place
- ⌥F1 displays the current file selection target pop-up layer, there are many targets in the pop-up layer to choose from (for example, you can select the Finder to display the file in the code editing window)
- ⌘B / ⌘ Click the mouse to enter the interface or definition of the method/variable where the cursor is located
- ⌘⌥B Jump to the implementation, use it on a called method name, it will jump to the specific implementation, you can skip the interface
- ⌥ Space, ⌘Y Quickly open the definition of the method and class where the cursor is located
- ⌃⇧B Jump to the type declaration
- ⌘U Go to the method/interface definition of the parent class of the method where the cursor is currently located
- ⌃↓ / ⌃↑ The current cursor jumps to the previous/next method name position of the current file
- ⌘] / ⌘[ Move the cursor to the start/end position of the curly brace of the current code
- ⌘F12 Pop up the current file structure layer, you can directly input on the pop-up layer to filter (can be used to search for methods in the class)
- ⌃H Display the hierarchy of the current class
- ⌘⇧H Display method hierarchy
- ⌃⌥H Display call hierarchy
- F2 / ⇧F2 Jump to the next/previous position that highlights the error or warning
- F4 / ⌘↓ edit/view code source
- ⌥ Home displays the navigation bar to the current file
- F3 Select file/folder/code line, add/cancel bookmark
- ⌥F3 Select file/folder/code line, use mnemonic to add/cancel bookmark
- ⌃0...⌃9 Navigate to the bookmark position of the corresponding value
- ⌘F3 show all bookmarks
Refactor
- F5 Copy files to the specified directory
- F6 Move files to the specified directory
- ⌘⌫ To delete the file safely on the file, a confirmation box pops up
- ⇧F6 Rename file
- ⌘F6 Change signature
- ⌘⌥N consistency
- ⌘⌥M Extract the selected code as a method
- ⌘⌥V to extract variables
- ⌘⌥F Extract field
- ⌘⌥C Extract constant
- ⌘⌥P Extract parameters
version control
- ⌘K Submit code to the version controller
- ⌘T Update code from version controller
- ⌥⇧C View recent change history
- ⌃C Quick pop-up version controller operation panel
template
- ⌘⌥J The template selection window pops up, and the selected code is wrapped in a dynamic template
- ⌘J Insert custom dynamic code template
other
- ⌘1...⌘9 Open the corresponding numbered tool window
- ⌘S save all
- ⌘⌥Y sync, refresh
- ⌃⌘F Switch to full screen mode
- ⌘⇧F12 Switch to maximize editor
- ⌥⇧F Add to favorites
- ⌥⇧I Check the current file and the current configuration file
- `§⌃, ⌃“ Quickly switch the current scheme (switch theme, code style, etc.)
- ⌘, open IDEA system settings
- ⌘; Open the project structure dialog
- ⇧⌘A Search action (related options can be set)
- ⌃⇥ Switch between the editing window label and the tool window (if you press delete during the switching process, the corresponding selected window is closed)
- ⌘⇧8 Vertical editing mode
- ⌃⌘F Switch to full screen mode
Shortcut keys for Windows
edit
- Ctrl + Space basic code completion (classes, methods, attributes)
- Ctrl + Alt + Space quickly import any class
- Ctrl + Shift + Enter statement completed
- Ctrl + P parameter information (call parameters in the method)
- Ctrl + Q Quickly view documents
- F1 external document
- Shift + F1 External document, enter the web document homepage
- Ctrl + Shift + Z --> Redo
- Ctrl + mouse introduction/enter code definition
- Ctrl + F1 display error description or warning message
- Alt + Insert automatically generates code
- Ctrl + O re-method
- Ctrl + Alt + T select
- Ctrl + / comment/uncomment
- Ctrl + Shift + / block comment
- Ctrl + W select the added code block
- Ctrl + Shift + W back to the previous state
- Ctrl + Shift + ]/[ End and start of selected code block
- Alt + Enter quick fix
- Ctrl + Alt + L code formatting
- Ctrl + Alt + O optimize import
- Ctrl + Alt + I auto indent
- Tab / Shift + Tab indent, not indent the current line
- Ctrl+X/Shift+Delete cut the current line or selected code block to the clipboard
- Ctrl+C/Ctrl+Insert copy the current line or selected code block to the clipboard
- Ctrl+V/Shift+Insert to paste from clipboard
- Ctrl + Shift + V Paste from the nearest buffer
- Ctrl + D Copy selected area or line
- Ctrl + Y delete the selected row
- Ctrl + Shift + J add smart line
- Ctrl + Enter Smart wire cutting
- Shift + Enter to start a new line
- Ctrl + Shift + U Switch between selected areas or code blocks
- Ctrl + Delete delete to the end of the character
- Ctrl + Backspace delete to the beginning of the character
- Ctrl + Numpad+/- expand/collapse code block (current position: function, comment, etc.)
- Ctrl + shift + Numpad+/- expand/collapse all code blocks
- Ctrl + F4 Close the running tab
Find/replace
- F3 next
- Shift + F3 Previous
- Ctrl + R replace
- Ctrl + Shift + F or hit shift twice in a row, global search {you can find a certain string in the entire project, such as searching for a function name string to see how the function was used before}
- Ctrl + Shift + R global replacement
- Alt + F7/Ctrl + F7 query usage in file
- Ctrl + Shift + F7 highlight the usage in the file
- Ctrl + Alt + F7 show usage
run
- Alt + Shift + F10 operating mode configuration
- Alt + Shift + F9 debug mode configuration
- Shift + F10 run
- Shift + F9 debugging
- Ctrl + Shift + F10 Run editor configuration
- Ctrl + Alt + R run .py task
debugging
- F8 skip
- F7 to enter
- Shift + F8 to exit
- Alt + F9 to run the cursor
- Alt + F8 verify expression
- Ctrl + Alt + F8 Quickly verify expression
- F9 recovery procedure
- Ctrl + F8 breakpoint switch
- Ctrl + Shift + F8 view breakpoints
navigation
- Ctrl + N jump to class
- Ctrl + Shift + N jump to symbol
- Alt + Right/Left jump to the next and previous edited tab
- F12 Go back to the previous tool window
- Esc Return to the editing window from the tool window
- Shift + Esc hide running and recently running windows
- Ctrl + Shift + F4 Close the active tab
- Ctrl + G View the current line number and character number
- Ctrl + E pop up the current file, open the list of recently used files
- Ctrl+Alt+Left/Right back, forward
- Ctrl+Shift+Backspace Navigate to the most recent editing area
- Alt + F1 Find the current file or logo
- Ctrl+B / Ctrl+Click jump to the statement
- Ctrl + Alt + B jump to implementation
- Ctrl + Shift + I view quick definition
- Ctrl + Shift + B jump to type declaration
- Ctrl + U jump to parent method, parent class
- Alt + Up/Down jump to the previous and next method
- Ctrl + ]/[ Jump to the end and start of the code block
- Ctrl + F12 pop up file structure
- Ctrl + H type hierarchy
- Ctrl + Shift + H method hierarchy
- Ctrl + Alt + H call hierarchy
- F2 / Shift + F2 next and previous highlighted error
- F4 / Ctrl + Enter Edit resources, view resources
- Alt + Home display navigation bar F11 bookmark switch
- Ctrl + Shift + F11 bookmark mnemonic switch
- Ctrl + #[0-9] Jump to the marked bookmark
- Shift + F11 show bookmark
Refactor
- F5 copy F6 cut
- Alt + Delete Safely delete
- Shift + F6 rename
- Ctrl + F6 change signature
- Ctrl + Alt + N inline
- Ctrl + Alt + M extraction method
- Ctrl + Alt + V extract attributes
- Ctrl + Alt + F to extract fields
- Ctrl + Alt + C extract constant
- Ctrl + Alt + P to extract parameters
version control
- Ctrl + K Submit project
- Ctrl + T update item
- Alt + Shift + C View recent changes
- Alt + BackQuote(') VCS pops up quickly
stencil
- Ctrl + Alt + J Use template for current line
- Ctrl +J insert template
other
- Alt + #[0-9] Open the corresponding tool window
- Ctrl + Alt + Y sync
- Ctrl + Shift + F12 Maximize editing switch
- Alt + Shift + F add to favorite
- Alt + Shift + I check the current file according to the configuration
- Ctrl + BackQuote(') Quickly switch the current plan
- Ctrl + Alt + S Open the settings page
- Ctrl + Shift + A find all actions in the editor
- Ctrl + Tab to switch between windows
Recommended reading
Essential knowledge for getting started with Python
100 small Python examples
how long will it take?
Which Python libraries make you hate each other late?
Numpy solves 100 levels, how many levels can you solve?
Pandas solves 100 levels, how many levels can you solve?
What office automation have you achieved with Python?
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。