There are many advantages to being a Delphi developer. Not only has the language kept pace with improvements added to other languages, such as C#, but it has maintained a remarkable consistency over its many years, first as Turbo Pascal, and later as Delphi. For example, routines originally written for Turbo Pascal in the 1980s often compile in the latest version of Delphi with little or no changes. There are not many languages you can say that about.
Delphi developers have also benefited from Delphi’s strong IDE (integrated development environment). From Delphi 1 through RAD Studio 2009, Delphi’s IDE has provided developers with state-of-the-art features that support and improve the overall development experience.
Did you know that Delphi can record (Ctrl+Shift+R) and playback (Ctrl+Shift+P) a series of keystrokes?
Unfortunately, not all of the capabilities of Delphi’s IDE are well known. Consider this. Did you know that Delphi can record (Ctrl+Shift+R) and playback (Ctrl+Shift+P) a series of keystrokes? It’s my impression that at least half of Delphi developers do not know this. But it is a feature that has been available in Delphi since version 1.
Part of the problem is that the various keystrokes supported by Delphi’s IDE have been notoriously hard to find in Delphi’s help. Some of them have never been documented. For example, one of my favorite keystroke combinations is Ctrl+<spacebar>, which invokes the Argument Value List drop down. Whenever you are entering the value of an expression, for example, the left side of an assignment statement or a parameter of a function, pressing Ctrl+<spacebar> displays a list of the possible symbols that would satisfy the expression. This feature, which was added in Delphi 3, appeared in the Delphi 4 help files only. It wasn’t in Delphi 3’s help, and has been missing in action since Delphi 5.
Another interesting item to note is that, although Delphi’s IDE has undergone major revisions in the past few years with the introduction of the Galileo IDE, the keystrokes available in the IDE, and the editor specifically, have not changed much at all. In particular, nearly every keystroke combination that was available in Delphi 1 still works in Delphi 2009.
But there is still the problem of documentation. When I inspected the most recent help that ships with RAD Studio 2007, I found that just over half of the editor’s keystroke combinations appeared in the help. The others were nowhere to be found.
And this brings us to the essence of this article. I have attempted to collect here, in Table 1, many of the editor keystroke combinations that I am aware of (the complete list will be on the website-version of this article, because it would be too long in a magazine). These keystroke combinations are for the default key mapping, which is used by most Delphi developers. If you are using one of the other key mappings, some of these combinations will not work, but many will.
I also want to admit that most of this table’s contents was derived from Delphi’s help files. In other words, while I compiled this table, I did not write most of the entries myself. Some entries appear exactly as they did in the help files, and I wrote some as well.
Furthermore, I edited many of the help file entries, either to make corrections or to simplify the description. I also removed entries that were in the help files that either didn’t work correctly, or appeared to not work at all. Finally, I didn’t include many keystrokes that are not code editor specific. For instance, I did not include debugging related keystrokes.
So here, for your consideration and enjoyment, is a comprehensive list of the keystrokes supported by Delphi’s editor. This list is presented in alphabetical order, by key. When two key or key combinations perform the same task, they both appear in the left column.
The full list can be downloaded from www.sdn.nl
Table 1. Delphi Editor Keystrokes for the Default Key Mapping
| Key/Key Combination |
Action |
Alt+Up Arrow
Ctrl+Left Click |
Starts code browsing |
| Click+Alt+Mouse Drag |
Selects column-oriented blocks |
| Ctlr+/ |
Comments or uncomments the current line or selected block |
| Ctrl+Alt+F12 |
Displays list of open files |
| Ctrl+Alt+Shift+End |
Selects the column from the cursor position to the end of the current file |
| Ctrl+Alt+Shift+Home |
Selects the column from the cursor position to the start of the current file |
| Ctrl+Alt+Shift+Left Arrow |
Selects the column to the left of the cursor |
| Ctrl+Alt+Shift+Page Down |
Selects the column from the cursor position to the top of the screen |
| Ctrl+Alt+Shift+Page Up |
Selects the column from the cursor position to the bottom of the screen |
| Ctrl+Alt+Shift+Right Arrow |
Selects the column to the right of the cursor |
| Ctrl+Backspace |
Deletes the word to the right of the cursor |
| Ctrl+E |
Starts Incremental Search |
| Ctrl+O+A |
Triggers Open file at cursor or go to declaration |
| Ctrl+O+B |
Browses symbol at cursor |
| Ctrl+O+C |
Turns on column blocking |
| Ctrl+O+G |
Go to line number |
| Ctrl+O+K |
Turns off column blocking or line blocking |
| Ctrl+O+L |
Turns on line block mode |
| Ctrl+O+O |
Inserts compiler options and directives |
| Ctrl+O+U |
Toggles case of block |
| Ctrl+P |
Causes next character to be interpreted as an ASCII sequence |
| Ctrl+Q+[Alt-[ |
Finds the matching delimiter (forward) |
| Ctrl+Q+]Alt-] |
Finds the matching delimiter (backward) |
| Ctrl+Q+A |
Displays Replace dialog |
| Ctrl+Q+B |
Moves to the beginning of a block |
| Ctrl+Q+F |
Displays Find dialog |
| Ctrl+Q+K |
Moves to the end of a block |
| Ctrl+Q+K |
Moves to the end of block |
| Ctrl+Q+P |
Moves to previous position |
| Ctrl+Q+R |
Moves to the beginning of a file |
| Ctrl+Q+S; Home |
Moves to the beginning of a line |
| Ctrl+Q+T |
Shifts editor so the current line is at the top of the window |
| Ctrl+Q+U |
Shifts editor so the current line is at the top of the window, if possible |
| Ctrl+Q+X |
Moves the cursor to the bottom of the window |
| Ctrl+Q+Y |
Deletes to the end of a line |
| Ctrl+Shift+<space bar> |
Displays Code Parameters pop-up window |
| Ctrl+Shift+A |
Displays Find unit dialog |
| Ctrl+Shift+D |
Displays the Declare Field dialog |
| Ctrl+Shift+Down Arrow |
Jump between declaration and implementation |
| Ctrl+Shift+E |
Displays Rename refactoring dialog |
| Ctrl+Shift+End |
Selects from the cursor position to the end of the current file |
| Ctrl+Shift+K+A |
Expands all collapsed regions |
| Ctrl+Shift+K+E |
Collapses current region |
| Ctrl+Shift+K+G |
Collapses interface, implementation, initialization, and finalization sections |
| Ctrl+Shift+K+M |
Collapses all methods |
| Ctrl+Shift+K+N |
Collapses unit |
| Ctrl+Shift+K+O |
Enables/disables code folding |
| Ctrl+Shift+K+P |
Collapses nested procedures |
| Ctrl+Shift+K+R |
Collapse all custom regions |
| Ctrl+Shift+K+T |
Expands/collapses current region |
| Ctrl+Shift+P |
Playback a key macro |
| Ctrl+Shift+R |
Starts/stops recording a key macro |
| Ctrl+Shift+Right Arrow |
Selects the word to the right of the cursor |
| Ctrl+Shift+Tab |
Moves to the previous code page (or file) |
| Ctrl+Shift-K+C |
Collapses all classes |
| Shift+Alt+Arrow; Alt+Mouse Drag |
Selects column-oriented blocks |
| Shift+Alt+Arrow; Click+Alt+Mouse Drag |
Selects column-oriented blocks |