Hello everyone! I finally got format on save to work with Notepad++! I’m extremely excited and wanted to create a guide. Hopefully it saves future developers some time, it took me forever haha.
Installation Steps
- Download a 64-bit version of Notepad++.
- Install @faustinoaq’s awesome Crystal Installer for Windows
- In Notepad++, go to
Plugins->Plugins Admin, search forNppExecand install. Restart. - In Notepad++, go to
Plugins->NppExec->Execute, and copy this code into the box:
npp_save
"C:\Program Files (x86)\Crystal\crystal.bat" & cd $(CURRENT_DIRECTORY) & crystal tool format $(FILE_NAME)
npp_open $(FULL_CURRENT_PATH)
- Then, click on
Save...and name itCrystalFormatter(or whatever you like). - Now go to
Plugins->NppExec->Advanced Optionsand underAssociated scripts, clickCrystalFormatter. Then clickAdd/Modify, then checkPlace to the Macro submenu.
Example. Restart. - And voila! Under the
Macromenu,CrystalFormatterappears!
Setup Format On Save (Ctrl+S)
- Open Settings → Shortcut Mapper… .
- On the Main menu tab, highlight the entry for “Save”. Click
Clearat the bottom of the window to clear the hotkey settings for that item ( Ctrl+S ). - Select the Plugin commands tab. Scroll down and highlight the entry for your
NppExeccommand script (identified byCrystalFormatter). - Click
Modifyand set the appropriate hotkey options (markCtrland chooseSfrom the dropdown). - Click
OKto save the new shortcut settings andClosethe Shortcut Mapper… . Source
Crystal Syntax Highlighting
- Download the XML file from https://gist.github.com/apfeltee/dec1681ed47977b1b6b0
- In Notepad++, go to
Language->Define your language...click onImport...and select the.xmlfile. - Now you can select
Crystalfrom theLanguagemenu.
Quality Of Life Features
-
Settings->Preferences..., on the left menu selectLanguage, changeTab sizeto 2 (matches Crystal’s formatter). -
Settings->Preferences..., on the left menu selectMISC., then checkUpdate silently. This is important for format on save to work smoothly.


