Clément 148 Posted July 22, 2022 (edited) Hi, I was wondering if there's a feature (or plugin) that would allow me to right click a folder and add a new unit direct in that folder. For example: When I right-click "task.code" folder, I would like the context menu to display two new options "add new unit" and "add new existing unit". When selecting "add new unit", "Unit1.pas" would be created under "task.code" allowing me to renaming that unit directly and start working on it. Do you know if there's such a tool? I'm using D11.1 TIA, Clément Edited July 22, 2022 by Clément Share this post Link to post
Steven Kamradt 20 Posted August 1, 2022 While I see what your getting at, this feature kind of already exists if you right click on the project, not the folder. When you add a new unit, it creates a dirty buffer that has not yet been saved. Saving it prompts you for the name, which defaults to unit1.pas (or next available number) in the project directory. In the save dialog its trivial to click on a folder (or create a new one) and save it there instead. The first thing I generally do when I create a new unit is save the file and give it a proper name and location. The folders don't show up until you add a file that is in a folder other than the dproj project folder location. As far as adding multiple existing units from a directory, I just drag and drop from explorer to the project and it "automagically" puts them in the appropriate folder (based on the existing location of course). Much simpler than clicking the button or right clicking to add to the project, unless its a one off. 2 Share this post Link to post
Clément 148 Posted August 1, 2022 (edited) Right-clicking on the project is what I do. Including the dragging part. This is a time saver. On the other hand working on bigger projects, right clicking on a folder and beeing able to add a new unit to the correct place would be great too. I googled for some tools for that, but found nothing. I'm working on a plugin to add "New unit" and "Add existing" to the context menu at the folder level. Edited August 1, 2022 by Clément Share this post Link to post