SoFunction
Updated on 2024-11-14

Sharing PyCharm shortcuts for Mac

Mac Keyboard Symbols and Modifier Keys Explained

  • ⌘ Command
  • ⇧ Shift
  • ⌥ Option
  • ⌃ Control
  • ↩︎ Return/Enter
  • ⌫ Delete
  • ⌦ Delete key forward (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)

Editing

  • ⌃Space Basic code completion (completing any class, method, variable)
  • ⌃ ⇧Space Smart Code Completion (filter method list and expected types of variables)
  • ⌘⇧ Automatically end code, automatically add semicolon at end of line
  • ⌘P Display information about the parameters of the method
  • ⌃J, Mid. button click Quick View Documentation
  • ⇧F1 View External Documentation (triggers opening a browser to display relevant documentation on some code)
  • ⌘+mouse over code Displays brief information about the code
  • ⌘F1 Display specific descriptive information at the error or warning
  • ⌘N, ⌃, ⌃N Generate code (getter, setter, constructor, hashCode/equals, toString)
  • ⌃O Override methods (override parent class methods)
  • ⌃I Implementing Methods (implementing methods in an interface)
  • ⌘⌥T wrap code (wrap selected code using if...else, try...catch, for, synchronized, etc.)
  • ⌘/ Annotation/Uncommenting with line comments
  • ⌘⌥/ Annotate/Uncomment with Block Comments
  • ⌥↑ Continuously selected code blocks
  • ⌥↓ Reduce the currently selected code block
  • ⌃⇧Q Display contextual information
  • ⌥ Show Intentional Actions and Quick Fix Codes
  • ⌘⌥L Formatting code
  • ⌃⌥Optimizationimport
  • ⌃⌥I Automatic indentation line
  • ⇥ / ⇧⇥ Indent Code / Anti-Indent Code
  • ⌘X Cut the current row or selected block to the Clipboard
  • ⌘C Copy the current line or selected block to the clipboard
  • ⌘V Paste from clipboard
  • ⌘⇧V Paste from nearest buffer
  • ⌘D Copy the current line or selected block
  • ⌘⌫ Delete the current line or the line of the selected block
  • ⌃⇧J intelligently splices the code into one line
  • ⌘ Intelligent splitting of spliced rows
  • ⇧ Starts a new line
  • ⌘⇧U Case switching
  • ⌘⇧] / ⌘⇧[ select until end/begin of code block
  • ⌥⌦ Delete to the end of the word (⌦ key is Fn+Delete)
  • ⌥⌫ Delete to the beginning of the word
  • ⌘+ / ⌘- Expand / Collapse Code Blocks
  • ⌘⇧+ expand so code block
  • ⌘⇧- Collapse all code blocks
  • ⌘W Close the active editor tab

Search/Replace

  • Double ⇧ Query anything
  • ⌘F Find in File
  • ⌘G Find Down in Find Mode
  • ⌘⇧G Find Up in Find Mode
  • ⌘R Replacement within a file
  • ⌘⇧F Global Find (by path)
  • ⌘⇧R global replacement (based on path)
  • ⌘ ⇧S query structure (Ultimate Edition version specific, needs to be set in Keymap)
  • ⌘⇧M Replace Structure (Ultimate Edition version specific, needs to be set in Keymap)

Usage Search

  • ⌥F7 / ⌘F7 Find Usage in Files / Find Usage in Classes
  • Usage of ⌘⇧F7 to highlight in a file
  • ⌘⌥F7 Show Usage

Compile and Run

  • ⌘F9 Compile Project
  • ⌘⇧F9 Compile the selected file, package or module
  • ⌃⌥R brings up a menu of options for Run
  • ⌃⌥D pops up the Debug selectable menu
  • ⌃R Operation
  • ⌃D Commissioning
  • ⌃⇧R, ⌃⇧D Run Contextual Environment Configuration from Editor

Debugging

  • F8 Go to the next step, if the current line breakpoint is a method, do not enter the current method body
  • F7 to go to the next step, if the current line breakpoint is a method, it will go into the current method body, if there is another method in that method body, it will not go into the embedded method
  • ⇧F7 Smart Step, multiple method calls on the line where the breakpoint is, will popup which method to enter
  • ⇧F8 Jump out
  • ⌥F9 Run to the cursor, if there is another breakpoint before the cursor it will go to that breakpoint
  • ⌥F8 Calculation expression (you can change the value of the variable to make it work)
  • ⌘⌥R Resume program execution, stopping at the next breakpoint if there is another breakpoint in the code below that breakpoint
  • ⌘F8 toggle breakpoints (cancel breakpoints if there is one on the cursor's current line, add one if there is not)
  • ⌘⇧F8 View breakpoint information

Navigation

  • ⌘O Find Class Files
  • ⌘⇧O Finds all types of files, opens files, opens directories, and opens directories requiring a backslash before or after what is typed /
  • ⌘⌥O Go to the specified variable/method
  • ⌃← / ⌃→ Toggle open edit tabs left and right
  • F12 Return to previous tool window
  • ⎋ Access the Code File window from the Tools window
  • ⇧⎋ hides the current or last active window and the cursor goes to the code file window
  • ⌘⇧F4 Close active run/messages/find/... tab
  • ⌘L Jump to a specified place on a line in the current file
  • ⌘E Display a list of recently opened file records
  • ⌘⌥← / ⌘⌥→ Back / Forward to the previous operation
  • ⌘⇧⌫ Skip to last edit
  • ⌥F1 Display the current file selection target pop-up layer, there are many targets in the pop-up layer that can be selected (e.g., in the code editing window you can choose to display the Finder for that file)
  • ⌘B / ⌘ mouse click Go to the interface or definition of the method/variable where the cursor is located
  • ⌘⌥B jumps to the implementation, using it on the name of a particular called method will jump to the specific implementation, you can skip the interface
  • ⌥ Space, ⌘Y Quickly opens the definition of the method, class, where the cursor is located
  • ⌃⇧B Jump to type declaration
  • ⌘U Go to the method/interface definition of the parent class of the method where the current cursor is located
  • ⌃↓ / ⌃↑ Current cursor jumps to the previous/next method name position of the current file
  • ⌘] / ⌘[ Move the cursor to the beginning/end of the curly brackets of the code you are currently in
  • ⌘F12 pops up the current file structure layer, you can filter by typing directly on the pop-up layer (can be used to search for methods in a class)
  • ⌃H Display the current class hierarchy
  • ⌘⇧H Show method hierarchy
  • ⌃⌥H Show call hierarchy
  • F2 / ⇧F2 Jump to the next/previous location that highlights an error or warning
  • F4 / ⌘↓ Edit/View Code Source
  • ⌥ Home Displays a navigation bar to the current file
  • F3 check files/folders/lines of code to add/uncheck bookmarks
  • ⌥F3 Check the file/folder/line of code and add/uncheck bookmarks using the helpers
  • ⌃0... ⌃9 Locate the bookmark position for the corresponding value
  • ⌘F3 Show all bookmarks

Refactoring

  • F5 Copy file to specified directory
  • F6 Move files to the specified directory
  • ⌘⌫ on the file for Secure File Deletion, a confirmation box pops up
  • ⇧F6 Rename File
  • ⌘F6 Change Signature
  • ⌘⌥N Consistency
  • ⌘⌥M Extracts the selected code as a method
  • ⌘⌥V Extracting variables
  • ⌘⌥F Extract Fields
  • ⌘⌥C Extracting constants
  • ⌘⌥P Extract parameters

VCS/Local History (Version Control/Local History)

  • ⌘K Commit Code to Version Controller
  • ⌘T Update code from version controller
  • ⌥⇧C View recent change logs
  • ⌃C Quick Eject Version Controller Operator Panel

Live Templates

  • ⌘⌥J brings up the template selection window and wraps the selected code with a dynamic template
  • ⌘J Insert Custom Dynamic Code Template

General

  • ⌘1... ⌘9 Open the tool window with the corresponding number
  • ⌘S Save all
  • ⌘⌥Y Synchronize, refresh
  • ⌃⌘F Toggle full screen mode
  • ⌘⇧F12 Toggle Maximize Editor
  • ⌥⇧F Add to Favorites
  • ⌥⇧I Check current file with current profile
  • `§⌃, ⌃" Quickly switch the current scheme (switch themes, code styles, etc.)
  • ⌘, open IDEA system settings
  • ⌘; Open the Project Structure dialog box
  • ⇧⌘A Find Action (with associated options)
  • ⌃⇥ Toggle between the Edit Window tab and the Tools window (if you press delete during the toggle, you are closing the corresponding selected window)

Other (some shortcuts not reflected in the official documentation)

  • ⌘⇧8 Vertical Edit Mode

navigator

  • ⌘O Find Class Files Ctrl + N
  • ⌘⌥O Go to the specified variable/method Ctrl + Shift + Alt + N
  • ⌃← / ⌃→ Toggle open edit tabs left and right Alt←/Alt→
  • ⎋ Access the Code File window from the Tools window ESC
  • ⌘L Jump to a specified place on a line in the current file Ctrl + G
  • ⌘E Display a list of recently opened file records Ctrl + E
  • ⌘⌥←/ ⌘⌥→Return / Advance to previous action Ctrl + Alt + ←/Ctrl + Alt + →
  • ⌘⇧⌫ Skip to last edit
  • ⌃H Display the current class hierarchy Ctrl + H
  • ⌘⇧H Show method hierarchy
  • ⌃⌥H Show call hierarchy
  • F4 /⌘↓ Edit/View Code Source
  • ⌘⌥U Display class UML diagrams
  • ⌃J View Note

compiler

  • ⌥⌦ Delete to the end of the word (⌦ key is Fn+Delete)
  • ⌥⌫ Delete to the beginning of the word
  • ⌘+ /⌘- Expand/Collapse Code Block
  • ⌘F1 Display specific descriptive information at the error or warning
  • ⌘⌥L Formatting code
  • ⌃⌥Optimizationimport
  • ⇧ Starts a new line
  • ⌘⇧ Automatically end code, automatically add semicolon at end of line
  • ⌃I Implementing Methods (implementing methods in an interface)
  • ⇧F6 Rename a file or variable
  • ⌘N,⌃,⌃N Generate code (getter, setter, constructor, hashCode/equals, toString)
  • ⌘P Display information about the parameters of the method

find

  • Double⇧ Find Anything
  • ⌘⇧F Global Find (by path)
  • ⌘F Find in File
  • ⌘G Find Down in Find Mode
  • ⌘⇧G Find Up in Find Mode

navigator

  • ⌘⌥B Jump to the implementation of the interface
  • ⌘U View Interface Definitions
  • ⌘⌥← /⌘⌥→ Return / Forward to the previous action
  • ⌘B /⌘ mouse click Go to the interface or definition of the method/variable where the cursor is located
  • ⌃⇧B Jump to type declaration
  • ⌥ Space,⌘Y quickly opens the definition of the method, class, where the cursor is located
  • ⌘O Find Class Files
  • ⌘⇧O Finds all types of files, opens files, opens directories, and opens directories requiring a backslash before or after what is typed /
  • F12 Return to previous tool window
  • ⎋ Access the Code File window from the Tools window
  • ⇧⎋ hides the current or last active window and the cursor goes to the code file window
  • F3 check files/folders/lines of code to add/uncheck bookmarks
  • ⌥F3 Check the file/folder/line of code and add/uncheck the bookmark with the helpers
  • ⌃0...⌃9 Locates the bookmark position of the corresponding value
  • ⌘F3 Show all bookmarks
  • ⌥F1 Display the current file selection target pop-up layer, there are many targets in the pop-up layer that can be selected (e.g., in the code editing window you can choose to display the Finder for that file)
  • ⌘F12 pops up the current file structure layer, you can filter by typing directly on the pop-up layer (can be used to search for methods in a class)

common (use)

  • ⌃⌘F Toggle full screen mode

autocode

  • ⚠ Note: ⌘ + J can call up all the code provided to complement can, the following is only a list of commonly used several

summarize

The above is a personal experience, I hope it can give you a reference, and I hope you can support me more.