ABOUT
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.
FEATURES
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.