Most useful shortcut in Eclipse CDT

C++EclipseKeyboard ShortcutsEclipse Cdt

C++ Problem Overview


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

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

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

C++ Solutions


Solution 1 - C++

Ctrl + Tab : Switch between source and header files.

Solution 2 - C++

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

Ctrl + Tab - Switch between source and header files.

Ctrl + Shift + T - Open Element

Ctrl + Shift + R - Open File/Resource.

Ctrl + = - Explore Macro Expansion.

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

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

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

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

Ctrl + d - Deletes current row

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

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

F3 - Open declaration

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

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

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

Ctrl + j - Incremental search in the current file

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

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

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

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

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

Ctrl + q - Jump to last location edited

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

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

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

Ctrl + Shift + </kbd> - Uncomment /* ... */ selected block

Solution 3 - C++

Ctrl + Shift + T : Open Element.

Ctrl + Shift + R : Open File/Resource.

Ctrl + = : Explore Macro Expansion.

Solution 4 - C++

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

Solution 5 - C++

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

Solution 6 - C++

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

Solution 7 - C++

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

Solution 8 - C++

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)

Solution 9 - C++

CTRL+B: Build all projects

CTRL+F11: Run

F11: Debug

> Note: The above shortcuts are applicable to all eclipse version


> Manual Shortcuts from Preference > General > Keys > > ALT+B: Build Project (current active project)

Solution 10 - C++

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

Solution 11 - C++

You have to change the default bindings to get these - but I like:

F3 : Open declaration.

F4 : Find text in project.

F4 is self-explanatory, but F3 has some intricacies: if you use it on a function call it will take you to the definition, and if you use it on a definition it will take you to the declaration.

Solution 12 - C++

Ctrl + Shift + G : When a function, object or var is selected : find all occurences of it in the project (works also with java).

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

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

Solution 13 - C++

Ctrl+Page Up: Go to the next source-file opened as a tab

Ctrl+Page Down: Go to the previous file

Solution 14 - C++

Ctrl+j : Incremental search in the current file

Ctrl+/(numerical keypad) : outline - folds all functions - for a quick view

Solution 15 - C++

Ctrl+Shift+f : this auto indents code

Solution 16 - C++

Ctrl+Shift+{ opens a parallel editor for same source file.

Solution 17 - C++

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

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

Solution 18 - C++

Alt + Shift + T : Selected method: Switch between inline, out of class in .h and out of class in .cpp

Solution 19 - C++

For me, this's one of the most useful key shortcuts, especially when in debug mode:

Alt + / - Go to previous / next cursor position.

Solution 20 - C++

The closest I'm getting to Eclipse for J2EE in creating classes is to (re)map (Preferences->General->Keys) "New (Class)" to Ctrl + 1, and selecting the non-existing class text before so it populates the new class dialog with the class name.

Unfortunately, you still have to enter source file and header file names in the dialog.

Solution 21 - C++

Alt + Shift + : Select a block.

Solution 22 - C++

Shift+ Alt+ G : Generate getters and setters (bind it)

Alt + Ctrl + : Duplicate the line(s)

Ctrl + Shift + / :Fold all

Ctrl + * :Unfold all

Ctrl + / :Enable/disable folding

Solution 23 - C++

Debugging:

F11 Start debugging

F5 Step into a function

F6 Step over a function

F7 Step out of a function

F8 Continue to next breakpoint

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionEtienne SavardView Question on Stackoverflow
Solution 1 - C++pdemarestView Answer on Stackoverflow
Solution 2 - C++w00tView Answer on Stackoverflow
Solution 3 - C++Dan BerindeiView Answer on Stackoverflow
Solution 4 - C++HaiView Answer on Stackoverflow
Solution 5 - C++raksliceView Answer on Stackoverflow
Solution 6 - C++Vincenzo PiiView Answer on Stackoverflow
Solution 7 - C++pdemarestView Answer on Stackoverflow
Solution 8 - C++ClaudiuView Answer on Stackoverflow
Solution 9 - C++YeoView Answer on Stackoverflow
Solution 10 - C++mefiXView Answer on Stackoverflow
Solution 11 - C++dlsView Answer on Stackoverflow
Solution 12 - C++Laurent DebriconView Answer on Stackoverflow
Solution 13 - C++BaloolaooView Answer on Stackoverflow
Solution 14 - C++tsenapathyView Answer on Stackoverflow
Solution 15 - C++user2481909View Answer on Stackoverflow
Solution 16 - C++Mostafa Saad IbrahimView Answer on Stackoverflow
Solution 17 - C++SanView Answer on Stackoverflow
Solution 18 - C++Justus SchwanView Answer on Stackoverflow
Solution 19 - C++Loukan ElKadiView Answer on Stackoverflow
Solution 20 - C++jotadepicasView Answer on Stackoverflow
Solution 21 - C++M AungView Answer on Stackoverflow
Solution 22 - C++Sergen ÇetinView Answer on Stackoverflow
Solution 23 - C++DanijelView Answer on Stackoverflow