How to make Notepad++ do some automatic cleanup before saving certain files?
-
I write VHDL source code. To keep code clean, I need to remove trailing spaces and convert tabs to spaces just before I save the file. I then commit it into Git repository. I want that this be done automatically.
Either I can increase the functionality of the save feature or, create a keyboard shortcut that will do the above things and also save the file. How do I go about doing this automation for VHDL files ONLY?
-
@Hassan-Iqbal said in How to make Notepad++ do some automatic cleanup before saving certain files?:
remove trailing spaces and convert tabs to spaces
You can do this part with a macro.
I then commit it into Git repository. I want that this be done automatically.
From what I know, you have to have done a “git add” on the file, then you can do a “git commit”. These are command-line options, so you can set something up on the Run menu to do that, I suppose.
But, would you really want to commit each and every time you save? I wouldn’t. I’d want that to be more “controlled”, logically.
-
The Git stuff will happen outside Notepad++
The thing is, I want to automate only the things within Notepad++You are implying that I can assign the macro to a keyboard shortcut? But how to make sure that the macro stays there every time I open Notepad++ or restart the computer?
-
@Hassan-Iqbal said in How to make Notepad++ do some automatic cleanup before saving certain files?:
You are implying that I can assign the macro to a keyboard shortcut?
The macro menu contains the item Modify Shortcut/Delete Macro…, there you can assign a shortcut after you have recorded the macro.
But how to make sure that the macro stays there every time I open Notepad++ or restart the computer?
Because the macro is stored in a file called shortcuts.xml.