【Python】PyCharm 快捷操作说明(Tip of the Day):Ctrl 键

目录

1. Ctrl

① 跳转到类、方法或变量的声明处 

2. Ctrl + 空格

① 代码自动完成功能

② 完成任何类的名称

③ 基本代码完成功能

④ 自动完成图片文件名

⑤ 调用代码完成功能的特殊变体

⑥ 查找命令行语法或可用函数

3. Ctrl + B

① 导航到代码中某个地方使用的类、方法或变量的声明处

② 导航 | 声明

4. Ctrl + C

①  复制光标所在行的整行内容

5. Ctrl + D

① 复制选定的块或当前行

6. Ctrl + E

① 查看 | 最近文件

7. Ctrl + F12

① 导航 | 文件结构

8. Ctrl + O

① 代码 | 覆盖方法 

9. Ctrl + P

① 显示有效参数列表 

② 查看 | 参数信息

10. Ctrl + Q

① 查看 | 快速文档

② 快速查看插入符号所在符号的文档

③ 查看项目的文档

11. Ctrl + W

① 选择光标所在的单词和源码的扩展区域

12. Ctrl + ↑

① 向上滚动历史命令行

13. Ctrl + ↓

① 向下滚动历史命令行

14. Ctrl + ·

① 查看 | 快速切换方案 (应用另一种代码样式 / 着色方案或键映射)

15. Ctrl + 鼠标单击 

① 浏览文件路径中的任何部分 

16. Ctrl + Alt + F7

① 主菜单中的编辑 | 查找 | 显示用法 

17. Ctrl + Alt + T

① 代码 | 包括在内(尝试 / 捕获异常) 

18. Ctrl + Alt + V

① 重构 | 提取 | 变量 

19. Ctrl + Shift + A

① 主菜单中的帮助 | 查找操作 

20. Ctrl + Shift + Backspace 

① 导航 | 上次编辑的位置(查找更改历史记录)

21. Ctrl + Shift + F7

① 编辑 | 查找 | 在文件中突出显示用法

22. Ctrl + Shift + I

① 查看光标引用的图像 

23. Ctrl + Shift + J

① 合并代码 

24. Ctrl + Shift + V 

① 黏贴 

25. Ctrl + Shift + ↑

① 代码 | 将语句上移

26. Ctrl + Shift + ↓

① 代码 | 将语句上移 / 下移 

27. Ctrl + Alt + Shift + I

① 快速查找和运行检查 

28. Ctrl + Alt + Shift + N

① 导航 | 符号



1. Ctrl

① 跳转到类、方法或变量的声明处 

To navigate to the declaration of a class, method or variable used somewhere in the code, position the caret at the usage and press Ctrl+B. 
You can also click the mouse on usages with the Ctrl key pressed to jump to declarations.

******************************** 译文 **********************************

要导航到代码中某个地方使用的类、方法或变量的声明处,只需将光标定位到使用位置,然后按 Ctrl+B 键。

您也可以按住 Ctrl 键点击用法以跳转到声明处。



2. Ctrl + 空格

① 代码自动完成功能

The Code Completion feature lets you quickly complete different kinds of statements in the code. 
For example, start typing a class name and press Ctrl+空格 to complete it. 
When multiple choices are available, they are shown in the lookup list.

******************************** 译文 **********************************
代码自动完成功能可以帮助您快速完成代码中不同类型的语句。

例如,开始输入类名并按下 Ctrl+空格 即可完成它。

当有多个选择时,它们会出现在查找列表中。


② 完成任何类的名称

A special variant of the Code Completion feature invoked by pressing Ctrl+空格 twice allows you to complete the name of any class no matter if it was imported in the current file or not. 
If the class is not imported yet, the import statement is generated automatically.

******************************** 译文 **********************************
按两次 Ctrl+空格 调用的代码完成功能的特殊变体允许您完成任何类的名称,无论它是否已在当前文件中导入。

如果尚未导入该类,则会自动生成导入语句。


③ 基本代码完成功能

When using basic code completion (Ctrl+空格), type any characters that exist anywhere in an identifier.

******************************** 译文 **********************************
当使用基本代码完成功能 (Ctrl+空格) 时,请输入标识符中任何位置存在的字符。


④ 自动完成图片文件名

Use Basic Completion (Ctrl+空格) within HTML, CSS and other files, for completing image file names.

******************************** 译文 **********************************
在 HTML、CSS 和其他文件中使用基本补全功能 (Ctrl+空格键) ,来自动完成图片文件名。


⑤ 调用代码完成功能的特殊变体

A special variant of the Code Completion feature invoked by pressing Ctrl+空格 twice allows you to complete XML tag names from namespaces not declared in the current file. 
If the namespace is not declared yet the declaration is generated automatically.

******************************** 译文 **********************************
按下 Ctrl+空格 键两次调用代码完成功能的特殊变体,允许您完成当前文件未声明的命名空间中的 XML 标记名称。

如果命名空间尚未声明,则会自动生成声明。


⑥ 查找命令行语法或可用函数

Working in the interactive consoles, you don't need to memorise the command line syntax or available functions. 
Instead, you can use the familiar code completion Ctrl+空格. 
Moreover, from within the lookup list, you can press Ctrl+Q to view the item's documentation.

******************************** 译文 **********************************

在交互式控制台上工作时,您无需记忆命令行语法或可用函数。 

相反,您可以使用熟悉的代码完成 Ctrl+空格 。 

此外,在查找列表中,您可以按 Ctrl+Q 查看项目的文档。



3. Ctrl + B

① 导航到代码中某个地方使用的类、方法或变量的声明处

To navigate to the declaration of a class, method or variable used somewhere in the code, position the caret at the usage and press Ctrl+B. 
You can also click the mouse on usages with the Ctrl key pressed to jump to declarations.

******************************** 译文 **********************************

要导航到代码中某个地方使用的类、方法或变量的声明处,只需将光标定位到使用位置,然后按 Ctrl+B 键。

您也可以按住 Ctrl 键点击用法以跳转到声明处。



② 导航 | 声明

The shortcuts such as Ctrl+Q (View | Quick Documentation), Ctrl+P (View | Parameter Info), Ctrl+B (Navigate | Declaration) 
and others can be used not only in the editor but in the code completion popup list as well.

******************************** 译文 **********************************

快捷键,如 Ctrl+Q(查看 | 快速文档),Ctrl+P(查看 | 参数信息),Ctrl+B(导航 | 声明)等,不仅可以在编辑器中使用,还可以在代码完成弹出列表中使用。



4. Ctrl + C

①  复制光标所在行的整行内容

If nothing is selected in the editor, and you press Ctrl+C, then the whole line at caret is copied to the clipboard.

******************************** 译文 **********************************

如果在编辑器中没有选中任何内容,按下 Ctrl+C ,则光标所在行的整行将被复制到剪贴板中。



5. Ctrl + D

① 复制选定的块或当前行

Ctrl+D in the editor duplicates the selected block or the current line when no block is selected.

******************************** 译文 **********************************
在编辑器中按下 Ctrl+D 会复制选定的块或当前行(当没有选定块时)。



6. Ctrl + E

① 查看 | 最近文件

Ctrl+E (View | Recent Files) brings a popup list of the recently visited files. 
Choose the desired file and press Enter to open it.
Besides recent files, you can bring up results of the usage searches you have performed recently. 
To do that, use the same Ctrl+E shortcut with the Find tool window having the focus, and select the desired find usages result from the Recent Find Usages popup.


******************************** 译文 **********************************

按下 Ctrl+E (查看 | 最近文件),会弹出最近访问文件的列表。

选择所需文件并按 Enter 键打开它。
除了最近的文件,您还可以查看最近执行搜索操作的结果。

要做到这一点,使用相同的 Ctrl+E 快捷键,在查找工具窗口中选择所需的 “查找使用情况” 结果从最近查找使用情况弹出窗口中。



7. Ctrl + F12

① 导航 | 文件结构

You can quickly navigate in the currently edited file with Ctrl+F12 (Navigate | File Structure).
It shows the list of members of the current class. 
Select an element you want to navigate to and press the Enter key or the F4 key.
To easily locate an item in the list, just start typing its name.

******************************** 译文 **********************************

你可以通过 Ctrl+F12(导航 | 文件结构)快速浏览当前正在编辑的文件。

它会显示当前类的成员列表。

选择要导航到的元素,然后按 Enter 键或 F4 键。

为了轻松定位列表中的项目,只需要开始输入它的名字即可。



8. Ctrl + O

① 代码 | 覆盖方法 

You can easily override the methods of the base class by pressing Ctrl+O (Code | Override Methods).

******************************** 译文 **********************************
您可以轻松通过按下 Ctrl+O (代码 | 覆盖方法) 来覆盖基类的方法。



9. Ctrl + P

① 显示有效参数列表 

If the cursor is between the parentheses of a method call, pressing Ctrl+P brings up a list of valid parameters.

******************************** 译文 **********************************

如果光标位于方法调用的括号之间,按下 Ctrl+P 将显示有效参数列表。


② 查看 | 参数信息

The shortcuts such as Ctrl+Q (View | Quick Documentation), Ctrl+P (View | Parameter Info), Ctrl+B (Navigate | Declaration) 
and others can be used not only in the editor but in the code completion popup list as well.

******************************** 译文 **********************************

快捷键,如 Ctrl+Q(查看 | 快速文档),Ctrl+P(查看 | 参数信息),Ctrl+B(导航 | 声明)等,不仅可以在编辑器中使用,还可以在代码完成弹出列表中使用。



10. Ctrl + Q

① 查看 | 快速文档

The shortcuts such as Ctrl+Q (View | Quick Documentation), Ctrl+P (View | Parameter Info), Ctrl+B (Navigate | Declaration) 
and others can be used not only in the editor but in the code completion popup list as well.

******************************** 译文 **********************************

快捷键,如 Ctrl+Q(查看 | 快速文档),Ctrl+P(查看 | 参数信息),Ctrl+B(导航 | 声明)等,不仅可以在编辑器中使用,还可以在代码完成弹出列表中使用。


② 快速查看插入符号所在符号的文档

To quickly see the documentation for the symbol at caret, press Ctrl+Q (View | Quick Documentation).

******************************** 译文 **********************************

快速查看插入符号所在符号的文档,请按 Ctrl+Q (查看 | 快速文档)。


③ 查看项目的文档

Working in the interactive consoles, you don't need to memorise the command line syntax or available functions. 
Instead, you can use the familiar code completion Ctrl+空格. 
Moreover, from within the lookup list, you can press Ctrl+Q to view the item's documentation.

******************************** 译文 **********************************

在交互式控制台上工作时,您无需记忆命令行语法或可用函数。 

相反,您可以使用熟悉的代码完成 Ctrl+空格 。 

此外,在查找列表中,您可以按 Ctrl+Q 查看项目的文档。



11. Ctrl + W

① 选择光标所在的单词和源码的扩展区域

Ctrl+W (extend selection) in the editor selects the word at the caret and then selects expanding areas of the source code. 
For example, it may select a method name, then the expression that calls this method, then the whole statement, then the containing block, etc. 
You can also select the word at the caret and the expanding areas of the source code by double-clicking the target areas in the editor.

******************************** 译文 **********************************

编辑器中的 Ctrl+W(扩展选择)会选择光标所在的单词,然后选择源码的扩展区域。

例如,它可能会选择方法名,然后选择调用该方法的表达式,然后选择整个语句,然后选择包含块等。

你也可以在编辑器中双击目标区域来选择光标所在的单词和源码的扩展区域。



12. Ctrl + ↑

① 向上滚动历史命令行

If you have already spent some time working in the interactive consoles, you don't need to re-type the previously entered commands to repeat them. 
Instead, press Ctrl+↑ and Ctrl+↓ to scroll through the history of commands.

******************************** 译文 **********************************

如果您已经在交互式控制台中花费了一些时间,您不需要重新输入先前输入的命令以重复它们。
取而代之的是,按 Ctrl +↑ 和 Ctrl +↓ 滚动命令历史记录。



13. Ctrl + ↓

① 向下滚动历史命令行

If you have already spent some time working in the interactive consoles, you don't need to re-type the previously entered commands to repeat them. 
Instead, press Ctrl+↑ and Ctrl+↓ to scroll through the history of commands.

******************************** 译文 **********************************

如果您已经在交互式控制台中花费了一些时间,您不需要重新输入先前输入的命令以重复它们。
取而代之的是,按 Ctrl +↑ 和 Ctrl +↓ 滚动命令历史记录。



14. Ctrl + ·

① 查看 | 快速切换方案 (应用另一种代码样式 / 着色方案或键映射)

With a single keystroke, you can apply another code style/coloring scheme or keymap right from the editor. 
Just press Ctrl+· (View | Quick Switch Scheme), to specify the scheme you want to change.

******************************** 译文 **********************************

只需按一次键,您就可以从编辑器中应用另一种代码样式/着色方案或键映射。

只需按 Ctrl+· (查看 | 快速切换方案) 来指定要更改的方案。



15. Ctrl + 鼠标单击 

① 浏览文件路径中的任何部分 

Ctrl+Click (on Windows) or Cmd+Click (on MacOS) a tab in the editor to navigate to any part of the file path. 
Select the necessary element in the drop-down, and the corresponding file path opens in an external browser (e.g., in the Explorer, if your OS is Windows).

******************************** 译文 **********************************

在编辑器中,如果您的操作系统是 Windows ,按下 Ctrl + 点击或 Cmd + 点击(如果您的操作系统是 MacOS)选项卡来浏览文件路径中的任何部分。
选择下拉菜单中的必要元素,相应的文件路径将在外部浏览器中打开(例如,在 Windows 下的文件夹中查看)。



16. Ctrl + Alt + F7

① 主菜单中的编辑 | 查找 | 显示用法 

You can bring forward the list of all usages of a class, method or variable across the whole project, and quickly jump to the selected usage. 
To do that, place the caret at the symbol's name or at its usage in code and press Ctrl+Alt+F7 (Edit | Find | Show Usages in the main menu), scroll the list and click the desired usage.

******************************** 译文 **********************************

您可以提取全项目中某个类、方法或变量的所有用法列表,并快速跳转到所选用法。
为此,请将光标放置在符号名称或其在代码中的使用上,并按下 Ctrl+Alt+F7(主菜单中的编辑|查找|显示用法),滚动列表并单击所需的用法。



17. Ctrl + Alt + T

① 代码 | 包括在内(尝试 / 捕获异常) 

When you want to catch exceptions thrown by some code fragment, select it in the editor, press Ctrl+Alt+T (Code | Surround With) and choose try/except. 
This will automatically generate the except clause.

******************************** 译文 **********************************

当你想要捕获一些代码片段抛出的异常时,在编辑器中选择它,按下 Ctrl+Alt+T(代码 | 包括在内)并且选择 尝试 / 捕获异常。
这将自动生成 except 语句块。



18. Ctrl + Alt + V

① 重构 | 提取 | 变量 

The Extract Variable refactoring helps you simplify complicated statements in your code. 
For example, in the code fragment below, you can select an expression in the code, and press Ctrl+Alt+V (Refactor | Extract | Variable).

******************************** 译文 **********************************

“提取变量” 重构可以帮助您简化代码中的复杂语句。

例如,在下面的代码片段中,您可以选择代码中的表达式,然后按 Ctrl+Alt+V(重构 | 提取 |  变量)。



19. Ctrl + Shift + A

① 主菜单中的帮助 | 查找操作 

To quickly find a menu command or toolbar action, you do not need to look through the menus. 
Just press Ctrl+Shift+A (Help | Find Action on the main menu) and start typing the name of the action. 
Choose the desired action from the suggestion list.

******************************** 译文 **********************************

想要快速找到菜单命令或工具栏操作,无需浏览菜单。

只需按 Ctrl+Shift+A(主菜单中的帮助|查找操作),然后开始键入操作的名称。

从建议列表中选择所需的操作即可。



20. Ctrl + Shift + Backspace 

① 导航 | 上次编辑的位置(查找更改历史记录)

Ctrl+Shift+Backspace (Navigate | Last Edit Location) brings you back to the last place where you made changes in the code.
Pressing Ctrl+Shift+Backspace a few times moves you deeper into your changes history.

******************************** 译文 **********************************

Ctrl+Shift+Backspace(导航 | 上次编辑的位置)将你带回到你在代码中做出更改的上次位置。
按下 Ctrl+Shift+Backspace 几次可以深入到你的更改历史记录。



21. Ctrl + Shift + F7

① 编辑 | 查找 | 在文件中突出显示用法

Use Ctrl+Shift+F7 (Edit | Find | Highlight Usages in File) to quickly highlight usages of some variable in the current file.
Use F3 and Shift+F3 keys to navigate through highlighted usages.
Press Esc to remove highlighting.

******************************** 译文 **********************************

使用 Ctrl+Shift+F7(编辑 | 查找 | 在文件中突出显示用法)快速突出显示当前文件中某个变量的用法。
使用 F3 或 Shift+F3 键浏览突出显示的用法。
按 Esc 键取消高亮显示。



22. Ctrl + Shift + I

① 查看光标引用的图像 

You can quickly view the image referenced at caret by using the Quick Definition (Ctrl+Shift+I). 
The underlying image will be opened in a popup instead of a separate editor tab.

******************************** 译文 **********************************

您可以使用快捷定义(Ctrl+Shift+I)快速查看光标引用的图像。
底层图像将在弹出窗口中打开,而不是在单独的编辑器选项卡中打开。



23. Ctrl + Shift + J

① 合并代码 

The Ctrl+Shift+J shortcut joins two lines into one and removes unnecessary spaces to match your code style.

******************************** 译文 **********************************
Ctrl+Shift+J 键是合并两行代码为一行并删除不必要的空格以匹配你的代码风格的快捷键。



24. Ctrl + Shift + V 

① 黏贴 

Use the Ctrl+Shift+V shortcut to choose and insert recent clipboard contents into the text.

******************************** 译文 **********************************
使用 Ctrl+Shift+V 快捷键选择并将最近剪贴板内容插入到文本中。



25. Ctrl + Shift + ↑

① 代码 | 将语句上移

The Code | Move Statement Up/Down action is useful for reorganizing the code lines in your file, e.g., for bringing a variable declaration closer to the variable usage.
For example, select a code fragment and press Ctrl+Shift+↑ or Ctrl+Shift+↓.
Before:
After moving the lines up:
After moving the lines down:
When there is no selection, the line at the cursor will be moved.


******************************** 译文 **********************************

“代码 | 将语句上移 / 下移” 功能可用于重新组织文件中的代码行,例如将变量声明移动到变量使用附近。
例如,选择一个代码片段,按下 Ctrl+Shift+↑ 或 Ctrl+Shift+↓。
之前:
将线条向上移动后:

将线条向下移动后:
当没有选择时,光标所在的行将被移动。



26. Ctrl + Shift + ↓

① 代码 | 将语句上移 / 下移 

The Code | Move Statement Up/Down action is useful for reorganizing the code lines in your file, e.g., for bringing a variable declaration closer to the variable usage.
For example, select a code fragment and press Ctrl+Shift+↑ or Ctrl+Shift+↓.
Before:
After moving the lines up:
After moving the lines down:
When there is no selection, the line at the cursor will be moved.


******************************** 译文 **********************************

“代码 | 将语句上移 / 下移” 功能可用于重新组织文件中的代码行,例如将变量声明移动到变量使用附近。
例如,选择一个代码片段,按下 Ctrl+Shift+↑ 或 Ctrl+Shift+↓。
之前:
将线条向上移动后:

将线条向下移动后:
当没有选择时,光标所在的行将被移动。



27. Ctrl + Alt + Shift + I

① 快速查找和运行检查 

To quickly find and run an inspection, press Ctrl+Alt+Shift+I and start typing the name of the inspection or its group. 
Choose the desired inspection from the suggestion list and then specify the desired scope.

******************************** 译文 **********************************

要快速查找和运行检查,请按 Ctrl + Alt + Shift + I,然后开始输入检查或其组的名称。

从建议列表中选择所需的检查,然后指定所需的范围。



28. Ctrl + Alt + Shift + N

① 导航 | 符号 

To open any particular method or field in the editor quickly, press Ctrl+Alt+Shift+N (Navigate | Symbol) and start typing its name.
Choose symbol from the drop-down list that appears.

******************************** 译文 **********************************

要快速在编辑器中打开任何特定方法或字段,请按 Ctrl+Alt+Shift+N(导航 | 符号)并开始输入其名称。
从出现的下拉列表中选择符号。

猜你喜欢

转载自blog.csdn.net/qq_39720249/article/details/129912399
今日推荐