This plug-in allows you to retrieve the name of the unit active in the Delphi IDE.  It optionally allows you to retrieve the unit name with or without a file extension.


This plug-in introduces a new String Function, CurrentUnitName(), that determines the name of the active unit in the IDE and returns it with the path removed.

When this plug-in is installed, you can reference the new function within the Keyboard Template editor.  Simply open the template you wish to edit and click the String Function button.  The following menu will appear.  Notice the highlighted item, this is your new function.

Selecting the CurrentUnitName item from the menu will update the Template Editor as follows:

Now, what happens when you launch this template?  Suppose you are working in the unit C:\Dev\MyApp\Source\Main.pas.  When you expand this template, the template shortcut CUN will be replaced with Main.

This function also accepts an optional parameter to allow it to return the unit name plus the file extension.  If we change our template to read %?CurrentUnitName(1)% (notice the parameter "1"), then our example above will return Main.pas instead of Main.


Version 1.0.0


CodeRush 6 / Source

CodeRush 7 / Source

Copyright 2006 Ackerson Software, All Rights Reserved.
Ackerson Software
Get Current Unit Name

Author: Rich Ackerson

Created: February 15, 2006

Plug-In Type: Standard

Options Page: No
This plug-in is currently supported.
This plug-in is not the property of Developer Express; it is the sole property of its author.  As such, Developer Express cannot be held liable for any incidental damages that may be related to the usage of this plug-in.