Advertisement #Header

10 Sep 2015

Add your Menu item in Notepad++ Editor

I love Notepad++ for several reasons.
  1. Notepad++ is simple Editor and loads very quickly unlike Eclipse or Dreamweaver.
  2. Its has a very good source code highlighting feature for most file types ( .php, .java. ,.xml, .js, .css, .html etc)
  3. "Find in Files" is a very good feature to find a particular text in files in a particular folder.
  4. Its open source.

Why add a menu item ?

I was learning php by source code hacks from github, but often certain library functions or keywords that i dont know, i have to check out in the web. This was slow and painful, especially when internet connection is slow. So downloaded the PHP Manual Help file ( .chm for Windows Machine ). Now i thought it would be really easy if i could integrate that help file into Notepad++ Editor's Menu or as a Shortcut command.

How to add a User-defined Command or Menu item in Notepad++ ?

1. Open any other editor other than Notepad++ and then close all the Notepad++ instances opened.
2. Open shorcuts.xml in that Editor in the folder
3. In the <UserDefinedCommands> section, add the command 

<Command name="PHP Manual" Ctrl="yes" Alt="no" Shift="yes" Key="80">
  hh.exe "ms-its:C:\PHP-Manual\php_manual_en.chm::/function.$(CURRENT_WORD).html"
<Command name="PHP Manual" Ctrl="yes" Alt="no" Shift="yes" Key="80">
  hh.exe "ms-its:C:\PHP-Manual\php_manual_en.chm::/function.$(CURRENT_WORD).html"

4. Save and open the Notepad++ Editor to see the new item in the Run Menu.
5. Also run the command by pressing "Ctrl + Shift + P".

Understanding the <Command>

attributes                 Value 

name            For Label to be shown in the Run Menu
Ctrl              yes | no ; For Shorcut Keyboard Command
Alt                yes | no ; For Shorcut Keyboard Command
Shift             yes | no ; For Shorcut Keyboard Command
Key              ASCII of the Key;  eg: 80 for 'P'

$(CURRENT_WORD)      variable for the current word selected.
<Command> command to execute </Command>