Notepad++ auto trim trailing spaces on save only for some file extensiones

notepad

I'm using a Notepad++ macro to 'Trim trailing and save' files. And I have setup to [Ctrl]+[S] hotkey.

But, sometimes I'm editing files that I need to keep their spaces. Is it possible to set up a macro only for some file extensions? Or there is another way to auto apply Trim trailing spaces on save only for some file extensions?

Note: I use Notepad++ to edit php files but also MarkDown files that need blank spaces at the end of some lines.

Update: I'm using Notepad++ for Windows.

Best Answer

Use the "Trim Trailing and save" macro:

Macro -> Trim Trailing and save

The default shortcut is:

Alt + Shift + s
Related Question