Pimp My Notepad++

Filed under: TechNotes, Development — lars @ 11:40:54 am

This post is a little inspired by Pimp My Gedit post at grigio.org about plugins for the Gnome/Linux text editor 'Gedit'.

I like Gedit on Linux, but Notepad++ is my favorite text editor on Windows.  I love how lightweight it is compared to IDEs like Visual Studio and Eclipse.  But I do miss some features of a full-blown IDE, particularly around the idea of "projects" - like being able to easily find and open files within a project.

Enter the Notepad++ "SolutionHub" plug-in!

To make the below work, you need to install the plugins "SolutionHub", "SolutionHub UI", "Open File In Solution" and "Solution Tools".  This will give you the ability to search for by name and open any file in your "project" - just like CTRL-SHIFT-R in Eclipse.  "SolutionTools" will give you the ability to highlight any filename within your code (eg: require_once('something.php');) and use a keyboard shortcut to open that file - just like Eclipse's F3 shortcut.

Here's how you set it up.

  1. Install the above 4 plugins from here (I just downloaded them manually and dropped them in my plugins directory).
  2. Start Notepad++.  Select Plugins -> SolutionHubUI -> SolutionHubUI Show from the menu
  3. Here you define your solution or project.  Click "New Solution" and enter a Name.  Then click the "Path" icon and select it's root folder.  Tick the "Recursive" and "Monitored" checkboxes to ensure the files within this folder are indexed, and you can optionally add Exclusions file filter to skip any files you don't want indexed (like "jpg gif png" files).
  4. Click "Save Solution", then double-click the "Connections" value in the table at the top and enter "ofis" as a connection for your new solution.  This will associate your solution with "Open File In Solution" to make this feature work.  Then click "Save Connections".  (You can define multiple solutions/projects, but only one can have the "ofis" association at one time.  This provides a crude way of switching between solutions/projects.)

    You should end up with something like this screenshot:
    SolutionHub UI screenshot
  5. Now test your Solution by going to the menu and selecting Plugins -> Open File In Solution -> OFIS - Show.  You should see a dialog that allows you to search all the files in your solution.
  6. Now we'll define some keyboard shortcuts.  Go to Settings -> Shortcut Mapper... and choose the "Plugin commands" tab.
  7. Find the entry called "OFIS - Show" and give it a shortcut.  I personally use Ctrl+Shift+R as that's what I'm used to from Eclipse, however this is used by the out-of-the-box Macro Record.  So I have to disable this shortcut manually under "Main Menu" tab.  (Unfortunately Notepad++ doesn't warn you if there's a clash).
  8. Next, find the entry under the "Plugin commands" tab called "ST - Open document" and give this another short-cut.  This is how you open files that are referenced in your source (like F3 in Eclipse).  I personally map this to Ctrl-Shift-=.
  9. That's it!

One more tip.  If you like the RubyBlue colour theme, grab the enhanced version that includes additional language support (like java).  It's available from http://www.maxahn.com/2010/12/customized-ruby-blue-theme-for-notepad/.

Happy tapping.

Comments

  • Stas
    I prefer to use Codelobster: http://www.codelobster.com

    Comment by Stas [Visitor] — 04/08/16 @ 00:57

  • Milen Boev
    Take a look at the plugin I wrote for this purpose: https://github.com/meboev/NppOpenFileInFolders

    Cheers :)

    Comment by Milen Boev [Visitor] — 12/20/16 @ 08:53

Leave a comment

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>


Options:
(Line breaks become <br />)
(Set cookies for name, email & url)




powered by  b2evolution