The Notepad++ Context Menu is the menu that appears when right clicking on the edit zone:
Users can change the Context Menu by adding/modifying the file contextMenu.xml. While you can open this file like any other file, the Settings -> Edit Popup ContextMenu command will do this for you.
Since this is a Notepad++ configuration file, it is to be found in the Notepad++ Install Folder. The changes made will be effective after Notepad++ restarts.
<NotepadPlus> <ScintillaContextMenu> <!-- Use MenuEntryName and MenuItemName to localize your commands to add. The values should be in English but not in translated language. (You can set Notepad++ language back to English from Preferences dialog via menu "Settings->Preferences...") --> <Item PluginEntryName="LineFIlter2" PluginCommandItemName="Filter lines"/> <Item MenuEntryName="Edit" MenuItemName="Cut"/> <Item MenuEntryName="Edit" MenuItemName="Copy"/> <Item MenuEntryName="Edit" MenuItemName="Paste"/> <Item MenuEntryName="Edit" MenuItemName="Delete"/>
As you can see, the file has commens for guiding user modifications.
Adding items to the Context Menu
All menu commands can be added to the Context Menu, including plugin commands:
- To add a built-in command, you need to provide the main menu name (as it appears in the main menu bar) as the value of the MenuEntryName attribute and the command's item name (as it appears in the menu) as the value of the MenuItemName attribute. The MenuEntryName attribute must reference an entry on the main menu bar and must be an ancestor of the MenuItemName attribute, regardless of its depth.
- To add a plugin command, you need to provide the plugin's menu item name (as it appears in the Plugins menu) as the value of the PluginEntryName attribute and the command's menu item name (as it appears in the plugin's sub-menu) as the value of the PluginCommandItemName attribute.
Plugin commands appearing outside the Plugins menu (e.g., TextFX) will not be found nor added as of version 6.6.6, as the Context Menu is loaded before plugins are notified that Notepad++ is ready to run.
Note that the value you add should be in English, not in a translated language. The Shortcut Mapper will help you find the English name of plugin commands; simply switch to English localization for the raw name of built-in commands. If you wish to use IDs, they can be found in menuCmdID.h.
If you add a FolderName="name_of_submenu" attribute to consecutive items, they will be grouped into a sub-menu with that name. Specifying "" is the same as leaving the FolderName attribute out. Note that sub-menus do not nest - you cannot add a sub-menu to a sub-menu. Non-Latin characters are supported.
If you add an ItemNameAs="new_name_for_the_item" attribute, the new name will be displayed instead of the standard one, which you'd get from the menu bar or its sub-menus. This is useful when the name is lengthy, as it makes the Context Menu unwieldy otherwise. Non-Latin characters are supported.
The Tab Bar Context Menu
For completeness' sake, there is another menu that would qualify as a context menu. It is the one that pops up when right clicking a tab in any view. However, there isn't much to say about it here, as it is not configurable. This is not related with its being practical. Plugins can manipulate it. See here for more information on the Tab Bar Context Menu.