Every programmer has his favorite keyboard shortcuts. Here are mine for Visual C++, from most used to least used, with some comments:
Jump to definition: F12
Jump to declaration: Ctrl + F12
Jump back (from any earlier jump): Ctrl + -
- The above 3 keyboard shortcuts are my key tools to peek into and understand any C++ code.
Compile currently open .cpp file: Ctrl + F7
- Every C++ programmer knows how frustratingly slow C++ compilers are! It is faster to first compile the currently modified file and proceed with a full solution build only if this succeeds. I typically keep compiling the current file while incrementally modifying a file and do a full build only much later when that part is completely coded.
Build solution: F7
Execute with debugging support: F5
Execute without debugging support: Ctrl + F5
Add or remove breakpoint on current line: F9
Find in entire solution and list in Find Results window: Ctrl + Shift + F
- The normal find (Ctrl + F and F3) only jumps to one result and the user can jump around from there. I find the listing of all occurrences in a separate window much more useful. I can see all the files where it is used and also see one line of usage in them. This is very useful to understand and refactor code.
Full Screen: Alt + Shift + Enter
- Visual Studio non-editor windows take too much space and combined with the Windows taskbar, they are all huge distractions while coding and debugging. So, I always work in full screen mode and switch back to normal size only to fix compile errors. But, the above default keyboard shortcut is hard to enter without causing side-effects, since it has Enter in it. So, I map this action to Ctrl + M, Ctrl + M instead. That is, keeping Ctrl pressed and press M twice. This is the keyboard shortcut for full screen in Eclipse. I find it easier to type and remember: M → Maximize 😊
Delete line: Shift + Del
- Useful while deleting many lines of code, which happens almost all the time.
Add or remove bookmark: Ctrl + K, Ctrl + K
- Easy to remember: bookmark ends with a K 😊 I find it very useful to leave a breadcrumb trail of bookmarks on lines where I need to modify or check code.
Jump to next bookmark: Crtl + K, Ctrl + N
- To follow the breadcrumb trail of bookmarks.