Returning to previous editor tab in Delphi

Having done a lot of Visual Studio work lately, I’ve grown accustomed to the VS way of switching between open file tabs with the Ctrl+Tab keystroke: it switches between files in Most Recently Used order, the same way Alt+Tab does for open programs. This is extra easy when, while coding, you have to do a lot of switching back and forth between just two or three files. You can do so from your keyboard without reaching for your mouse.

I didn’t notice how much I’ve gotten used to it, until recently I had to do a lot of Delphi work again. Using Ctrl+Tab in Delphi also switches between tabs, but in the order the tabs are placed at the top of the editing window (mostly the order you loaded them in). While this is admittedly more predictable when you have lots of files open, in practice I find it much less useful. When I have lots of files (tabs) open, I rarely use the tabs at the tab to switch between files but instead use the Project Manager or hit Ctrl+F12 and start typing the unit name.

Looking for a Delphi equivalent of VS-like behavior for Ctrl+Tab (or a plugin that takes care of it), I stumbled upon this post by Joe White from a couple of years back. He mentions the use of Ctrl+B, which brings up a opened units list, but with the units sorted in MRU order, and with the focus already on the previously opened unit. Because of this, Ctrl+B followed by ENTER, immediately brings you to the window you previously were.

Ctrl+B brings up a unit list in Most Recently Used order, focusing the previously opened unit.
Ctrl+B brings up a unit list in Most Recently Used order, focusing the previously opened unit.

Summarized (Visual Studio -> Delphi)

  • Ctrl+TAB -> Ctrl+B, ENTER
  • Ctrl+TAB,TAB -> Ctrl+B, down arrow, ENTER
  • Ctrl+TAB,TAB,TAB -> Ctrl+B, down, down, ENTER
  • etc.

Still not exactly, but almost as good.


Reacties

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *