Set the Notepad++ so that we can format the selected code automatically by press the hotkey.
Software/plugin used:
Notepad++ v5.5
NppExec Plugin v0.3.3.1
SourceFormatX v2.56
How to:
- Install the required software/plugin.
- Start Notepad++ and open the NppExec Execute dialog.
Enter the following commands:
NPP_CONSOLE ?
SET TMP_FILE = $(SYS.TEMP)\$(NAME_PART)_npp_tmp~$(EXT_PART)
SET BIN_DIR = "C:\Program Files\SourceFormatX\SourceFormatX.exe"
SEL_SAVETO $(TMP_FILE)
$(BIN_DIR) $(TMP_FILE)
SEL_LOADFROM $(TMP_FILE)
cmd /c del /q $(TMP_FILE)*
Note that the path BIN_DIR may depends on the directory where you install SourceFormatX.
- Save the commands with the name you like, e.g. Format by SourceFormatX.
Now when you select the code and run the command in NppExec, the code is formatted automatically.
- Let's set a shortcut key for the command for easier access.
Go to 'NppExec' -> 'Advanced Option', in the 'Menu items' we add the command we've just set.
- Then go to Notepad++ 'Settings' -> 'Shortcut Mapper' -> 'Plugin commands', set a unique shortcut for the command we've added.
Now the hotkey is ready. Try it!