C++ Eclipse CDT 中最有用的快捷方式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1266862/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 19:23:14  来源:igfitidea点击:

Most useful shortcut in Eclipse CDT

c++eclipsekeyboard-shortcutseclipse-cdt

提问by Etienne Savard

I would like to make a cheat sheet presenting the most useful (and time saving) shortcut for Eclipse CDT (C++).

我想制作一个备忘单,展示 Eclipse CDT (C++) 最有用(和省时)的快捷方式。

Can you share what are the most useful shortcuts that you use in CDT?

您能分享一下您在 CDT 中使用的最有用的快捷方式是什么吗?

Please, post only general shortcuts (available when doing C++) or CDT specific.

请仅发布通用快捷方式(在执行 C++ 时可用)或特定于 CDT。

回答by pdemarest

Ctrl+ Tab: Switch between source and header files.

Ctrl+ Tab: 在源文件和头文件之间切换。

回答by w00t

Summary of all the shortcuts in this thread and some more.

此线程中所有快捷方式的摘要以及更多。

Ctrl+ Tab- Switch between source and header files.

Ctrl+ Tab- 在源文件和头文件之间切换。

Ctrl+ Shift+ T- Open Element

Ctrl+ Shift+ T- 打开元素

Ctrl+ Shift+ R- Open File/Resource.

Ctrl+ Shift+ R- 打开文件/资源​​。

Ctrl+ =- Explore Macro Expansion.

Ctrl+ =- 探索宏扩展。

Ctrl+ Space- Show proposals to complete you've written.

Ctrl+ Space- 显示完成您所写的建议。

Ctrl+ Alt+ H- Opens the call hierarchy for a function

Ctrl+ Alt+ H- 打开函数的调用层次结构

Ctrl+ Shift+ N- Adds an #include for the header file in which the current element is declared

Ctrl+ Shift+ N- 为声明当前元素的头文件添加#include

Ctrl+ i- Corrects indentation of the selected text - very useful in my opinion

Ctrl+ i- 更正所选文本的缩进 - 在我看来非常有用

Ctrl+ d- Deletes current row

Ctrl+ d- 删除当前行

Ctrl+ h- Opens a search dialog; the "C/C++ Search" tab searches through indexed locations

Ctrl+ h- 打开搜索对话框;“C/C++ 搜索”选项卡搜索索引位置

Ctrl+ O- Opens a member browser of the current class, enabling to fastly open a method

Ctrl+ O- 打开当前类的成员浏览器,可以快速打开一个方法

F3- Open declaration

F3- 公开声明

Ctrl+ Shift+ G- When a function, object or var is selected : find all occurences of it in the project.

Ctrl+ Shift+ G- 当一个函数、对象或变量被选中时:在项目中找到它的所有出现。

Ctrl+ Alt+ G- Textual search of the currently selected text.

Ctrl+ Alt+ G- 当前所选文本的文本搜索。

Ctrl+ left click - Go to the definition of the item.

Ctrl+ 左键单击 - 转到项目的定义。

Ctrl+ j- Incremental search in the current file

Ctrl+ j- 在当前文件中增量搜索

Ctrl+ k- To search forward for a highlighted text in a file.

Ctrl+ k- 向前搜索文件中突出显示的文本。

Ctrl+ Shift+ k- To search backward for a highlighted text in a file

Ctrl+ Shift+ k- 向后搜索文件中突出显示的文本

Alt+ /- Go to previous / go to next edited or viewed place.

Alt+ / - 转到上一个/转到下一个编辑或查看的位置。

Ctrl+ m- Maximize or un-maximize current Editor Window (also works for other Windows

Ctrl+ m- 最大化或取消最大化当前编辑器窗口(也适用于其他 Windows

Ctrl+ Shift+ Up/Down Arrow - Jump to previous / jump to next method

Ctrl+ Shift+ 向上/向下箭头 - 跳转到上一个/跳转到下一个方法

Ctrl+ q- Jump to last location edited

Ctrl+ q- 跳转到最后编辑的位置

Ctrl+ Shift+ p- With a bracket selected: jump to the matching closing or opening bracket

Ctrl+ Shift+ p- 选择括号:跳转到匹配的右括号或左括号

Ctrl+ /- Comment/uncomment all selected lines with //

Ctrl+ /- 用 // 注释/取消注释所有选定的行

Ctrl+ Shift+ /- Comment selected block with /* ... */

Ctrl+ Shift+ /- 用 /* ... */ 注释选定的块

Ctrl+ Shift+ \- Uncomment /* ... */ selected block

Ctrl+ Shift+ \- 取消注释 /* ... */ 选定的块

回答by Dan Berindei

Ctrl+ Shift+ T: Open Element.

Ctrl+ Shift+ T:打开元素。

Ctrl+ Shift+ R: Open File/Resource.

Ctrl+ Shift+ R:打开文件/资源​​。

Ctrl+ =: Explore Macro Expansion.

Ctrl+ =:探索宏扩展。

回答by Hai

Ctrl+ Space: Show proposals to complete you've written.

Ctrl+ Space:显示建议以完成您所写的。

回答by rakslice

Ctrl+Shift+L: Shows a list of actions with their corresponding shortcuts. ;)

Ctrl+ Shift+ L:显示带有相应快捷方式的操作列表。;)

回答by Vincenzo Pii

Ctrl+Alt+H: Opens the call hierarchy for a function

Ctrl+ Alt+ H: 打开函数的调用层次

回答by pdemarest

Alt+ Shift+ R, N: Rename a function or variable throughout a project.

Alt+ Shift+ R, N: 在整个项目中重命名函数或变量。

回答by Claudiu

Here is a list of the ones I use most often (excluding the ones from previous responses):

以下是我最常使用的列表(不包括之前回复中的那些):

  • Ctrl+Shift+N- adds an include statement; the included header file is the one in which the current element is declared in

  • Ctrl+i- corrects indentation of the selected text - very useful in my opinion

  • Ctrl+d- deletes current row

  • Alt+/ - moves the selected text (or current line if no text is selected) up or down

  • Alt+/ - move to the previous/next location you edited; for example, if you browse through a few function declarations, and then want to go back to where you started from, press Alt+to move to the previous locations

  • Ctrl+h- opens a search dialog; the "C/C++ Search" tab searches through indexed locations and is fast, but the "File Search" tab searches through all the text in your projects, and can come in handy when you're searching for a "hidden" element (for example, when searching for a macro defined under an #ifdef _WINDOWS, but _WINDOWS is not currently defined in your project)

  • Ctrl+ Shift+ N- 添加一个包含语句;包含的头文件是在其中声明当前元素的头文件

  • Ctrl+ i- 更正所选文本的缩进 - 在我看来非常有用

  • Ctrl+ d- 删除当前行

  • Alt+ / -移动(如果没有文本被选中或电流线)的选定的文本向上或向下

  • Alt+ / - 移动到您编辑的上一个/下一个位置;例如,如果您浏览了几个函数声明,然后想返回到您开始的位置,请按Alt+移动到以前的位置

  • Ctrl+ h- 打开搜索对话框;“C/C++ 搜索”选项卡搜索索引位置并且速度很快,但“文件搜索”选项卡搜索项目中的所有文本,并且在搜索“隐藏”元素时会派上用场(例如例如,当搜索在 #ifdef _WINDOWS 下定义的宏时,但 _WINDOWS 当前未在您的项目中定义)

回答by Yeo

CTRL+B: Build all projects

CTRL+ B: 构建所有项目

CTRL+F11: Run

CTRL+ F11: 运行

F11: Debug

F11: 调试

Note: The above shortcuts are applicable to all eclipse version

注:以上快捷键适用于所有eclipse版本



Manual Shortcuts from Preference > General > Keys

ALT+B: Build Project (current active project)

来自首选项 > 常规 > 键的手动快捷方式

ALT+ B: 构建项目(当前活动项目)

回答by mefiX

Ctrl+ O: Opens a member browser of the current class, enabling to fastly open a method.

Ctrl+ O: 打开当前类的成员浏览器,可以快速打开一个方法。