Over many months of using VC 6, I've come up with a few keyboard shortcuts that are really handy, save a few
seconds here and there, and really impress co-workers. Many of the commands aren't apparent, and you wouldn't even
know some of them existed unless you went through the entire command list on the Keyboard tab in the Tools-Customize
dialog.
The first table lists the commands that I can't live without and use all the time. The second table lists commands
I don't use quite as often, but which I still find handy. Commands marked as "built-in" already have
the listed keyboard assignment. For the other commands, you'll need to map the keys yourself.
Must-Have Commands
Key
|
|
Command
|
|
Description
|
---|
Ctrl+Shift+up arrow | | WBGoToPrevious | | Moves to the previous function in the current file. |
Ctrl+Shift+down arrow | | WBGoToNext | | Moves to the next function in the current file. |
Ctrl+Shift+G | | FileGoTo (built-in) | | If the cursor is over a filename, opens that file. Usually you move the cursor up to an #include line and then
use this command. |
Ctrl+Shift+H | | WBOpenInclude | | Brings up a dialog listing all headers #include'd in the current file. Select a header and it will be opened. |
Ctrl+I | | SearchIncremental (built-in) | | Begins an incremental search. Press these keys and then start typing the text to search for. The caret will move
through the file as you type. Hit Enter to leave search mode. You can then use the other search keys (like F3)
to continue searching for the same text. |
Ctrl+Shift+F7 | | BuildRebuildAll | | Rebuilds all files in the current project. |
Ctrl+F3 | | FindNextWord (built-in) | | Finds the next occurrence of the word that the caret is currently over. |
Ctrl+Shift+F3 | | FindPrevWord (built-in) | | Same as Ctrl+F3, but searches backwards. |
Alt+F7 | | ProjectSettings (built-in) | | Opens the project settings dialog. |
Alt+Num * | | DebugShowNextStatement (built-in) | | Moves the caret to the next statement to be executed (only when broken in debug mode). |
Shift+Num * | | DebugShowNextStatement | | I add this key mapping because it's possible to type with one hand, while the previous one isn't. Yes, I'm lazy.
:) |
Ctrl+Shift+F9 | | DebugRemoveAllBreakpoints (built-in) | | Deletes all breakpoints. |
Ctrl+Alt+Shift+F9 | | DebugDisableAllBreakpoints | | Disables all breakpoints. |
Ctrl+M | | CheckMnemonicKeys (built-in) | | Checks for duplicate shortcut keys in a dialog or menu. |
Other Time-Savers
Key
|
|
Command
|
|
Description
|
---|
Ctrl+Enter | | LineOpenBelow | | Opens a blank line below the current line and moves the caret to the new line. |
Ctrl+Shift+F8 | | SelectColumn (built-in) | | Begins a selection - move the caret to select columns of text. Easier than Alt-dragging. |
Ctrl+Shift+S | | FileSaveAll | | Saves all open files. |
Alt+F8 | | SelectionFormat (built-in) | | Formats the selected text according to your indentation preferences. Great for when you cut & paste code out
of MSDN and the code loses its indentation. |
Ctrl+Alt+up arrow | | LevelUp | | Moves to the previous occurrence of a start of a block (for instance, the next left brace). |
Ctrl+Alt+down arrow | | LevelDown | | Moves to the next occurrence of an end of a block (for instance, the next right brace). |
Ctrl+Shift+X | | CutAppendNext | | Press these keys right before a cut (Ctrl+X) to append the cut text to the end of the clipboard. |
Ctrl+E | | GoToMatchBrace (built-in) | | If the caret is over a parenthesis, bracket, or brace, moves the caret to the matching character. |
Ctrl+Shift+E | | GoToMatchBraceExtend (built-in) | | Same as Ctrl+E, but selects the text between the matching characters as well. |
Ctrl+Shift+T | | WindowScrollToTop | | Scrolls the window so the current line is at the top of the window. |
Ctrl+Shift+C | | WindowScrollToCenter | | Scrolls the window so the current line is at the center of the window. |
Ctrl+Shift+B | | WindowScrollToBottom | | Scrolls the window so the current line is at the bottom of the window. |
Ctrl+J | | ConditionalUp (built-in) | | Moves back to an enclosing #if. |
Ctrl+K | | ConditionalDown (built-in) | | Moves forward to an enclosing #else or #endif. |
Ctrl+Alt+S | | WindowSplitHorizontal | | Splits a text editor window into two panes (with the split running horizontally). |
Alt+Up arrow | | WindowSwitchPaneUp | | Moves one pane up in a split window. |
Alt+Down arrow | | WindowSwitchPaneDown | | Moves one pane down in a split window |
Alt+Left arrow | | WindowSwitchPaneLeft | | Moves one pane left in a split window |
Alt+Right arrow | | WindowSwitchPaneRight | | Moves one pane right in a split window |
You can get the latest updates to this and my other articles at http://home.inreach.com/mdunn/code/
Michael lives in sunny Mountain View, California. He started programming with an Apple
//e in 4th grade, graduated from
UCLA with a math degree in 1994, and immediately landed a job as a QA engineer at Symantec, working on the Norton AntiVirus team. He pretty much taught himself Windows and MFC programming, and in 1999 he designed and coded a new interface for Norton AntiVirus 2000.
Mike has been a a developer at
Napster and at his own lil' startup, Zabersoft, a development company he co-founded with offices in Los Angeles and Odense, Denmark. Mike is now a senior engineer at
VMware.
He also enjoys his hobbies of playing pinball, bike riding, photography, and Domion on Friday nights (current favorite combo: Village + double Pirate Ship). He would get his own snooker table too if they weren't so darn big! He is also sad that he's forgotten the languages he's studied: French, Mandarin Chinese, and Japanese.
Mike was a
VC MVP from 2005 to 2009.