Notepad++ with Crystal

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 for NppExec and 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 it CrystalFormatter (or whatever you like).
  • Now go to Plugins -> NppExec -> Advanced Options and under Associated scripts, click CrystalFormatter. Then click Add/Modify, then check Place to the Macro submenu.
    Example. Restart.
  • And voila! Under the Macro menu, CrystalFormatter appears! :smiley: :love_you_gesture:

Setup Format On Save (Ctrl+S)

  • Open SettingsShortcut Mapper… .
  • On the Main menu tab, highlight the entry for “Save”. Click Clear at 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 NppExec command script (identified by CrystalFormatter).
  • Click Modify and set the appropriate hotkey options (mark Ctrl and choose S from the dropdown).
  • Click OK to save the new shortcut settings and Close the Shortcut Mapper… . Source

Crystal Syntax Highlighting

Quality Of Life Features

  • Settings -> Preferences... , on the left menu select Language, change Tab size to 2 (matches Crystal’s formatter).
  • Settings -> Preferences..., on the left menu select MISC., then check Update silently. This is important for format on save to work smoothly.
6 Likes

This is Awesome! :sparkles: :smile:

Thank you so much for this :+1: