Friday, May 29, 2009

Keystroke Combinations in Delphi’s Code Editor

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.

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 Delphi 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 might 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, every editor keystroke combination that I am aware of. 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. Some entries appear exactly as they did in the help files, but 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.

Permit me to list these main points again:

  1. These keystroke combinations are only for the code editor. I did not include debugger keystroke combinations or general IDE keystroke combinations

  2. These keystroke combinations are for the default keybinding. I made no attempt to include keystroke combinations for other keybindings

  3. Many of these descriptions are derived from some version of Delphi’s documentation

  4. I listed these combinations in alphabetical order. Yes, there are many other alternative orders that would have been useful as well, but I opted for an alphabetical order for simplicity

  5. I know that there must be some valid keystroke combinations that are missing (I specifically omitted those that did not appear to work). If you know of valid editor keystroke combinations that apply to the default keybinding that are missing, feel free to email those to me at I will try to update this table periodically with your contributions

So here, for your consideration and enjoyment, is a zip file that contains a PDF of a nearly complete 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.

Cary Jensen's Delphi Editor Keystroke Table

Copyright (c) 2009 Cary Jensen. All Rights Reserved.


  1. This comment has been removed by a blog administrator.

  2. "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#"

    Sorry, but in my opinion, this is incorrect. As understand it, it was only the current version of Delphi that brought in modern language features like generics and closures. There was no reason why generics couldn't have been included in Delphi 7, for instance - the technology was there.

    If Delphi had kept pace with C# in a timely fashion perhaps people wouldn't have left it in droves for .NET.

    Barry Carr

  3. Generics were added to C# in .NET 2.0, which was published significantly later than Delphi 7.
    As far as developers leaving Delphi due to it's arguable lack of modern language features, please consider that there are still more developers developing in Visual Basic 6 than in .NET.

  4. @Barry, Delphi got closures before Java.

  5. Cary,

    Great list, probably comprehensive. Easy for you to check that you've got them all, but difficult to make use of in alphabetical order.

    You might want to note this:

  6. Nice. There are a few goodies in there.

    But it would have been even nicer if the keybindings were somehow grouped by functionality instead.

    Personally, I think it is overkill to include keystroke combinations such as copy/paste as well as backspace, space, tab, up/down arrow (Those aren't even combinations...). I would expect the effects of pressing spacebar, backspace, a-z etc. to be obvious...

    Maybe if it was boiled down to the essentials it could fit onto a single printout - which would be nice for pinning onto the wall next to my screen for easy reference.

    On another note, I do not entirely agree with the 'keeping in pace' part. In my opinion, there have been no significant changes to the language between D7 and D2009 (apart from the abomination that was Delphi.NET).
    And even with the additions that HAVE come, some of them still have a significant 'beta' feel. Generics are still rather buggy both at compile- and run-time.
    But at least D2009 is a pretty stable IDE compared to the 2005-2007 releases, all of which were prone to sudden crashes and weird exceptions.