Defining User Commands
The Run menu starts with one static command, called "Run...". It allows you to run existing commands, or to create some more, binding them to a keyboard shortcut as an option. A command is a string which is passed to the Windows shell asis. Because of this, any paths which may conain non alphabetic characters shold appear between double quotes, because this is how Windows expects to read them.
All other commands but the last are user-definable or defined. For more details on editing them in shortcuts.xml, see Editing Configuration Files. For using them so as to drive external tools from Notepad++, please read External Programs.
Defining the command
Run -> Run.... brings a dialog up where you can enter the command text. Since this is often a program name, a browse button is available to choose it. The history of previous commands is also available.
You can Run the command, and possibly Save it - bailing out is an option too. On clicking Save, a new dialog pops up, asking you for the name and optional keyboard binding of the command.
Like for Macros, the name and binding can be changed from the Shortcut mapper. Run -> Modify shortcut / Delete command will bring it up for you. The steps to change or remove a command are the same as for macrros, but on a different tab, so please refer to Macros. You cannot change the text of a command from there; it has to be done in the shortcus.xml file.
Using the environment
Notepad++ provides a number of environment variables from which to build such commands. Even if the NppExec plugin is installed, the extra variables it defines are available only from its own console.
In order to quote an environment variable listed below, you must use the following syntax:
so as to substitute the whole of this text with the contents of the MY_ENV_VAR environment variable. Use the SYS. construct to access variables that are not provided by Notepad++.
Here are the available variables:
Say the current file you edit in Notepad++ is:
and the caret is currently on the word "Discover", located at line 26, column 5 in that file. Then:
|VVariable name||Contents in the above example setting|
|SYS.||system environment variable, e.g. $(SYS.PATH)|
|NPP_DIRECTORY||possibly C:\Program Files\Notepad++|
When text is selected, $(CURRENT_WORD) contains the full selected text.