Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Some text editors, like Notepad2, have the ability to run the file that's being edited. Can this be done with Notepad++?

share|improve this question

4 Answers 4

Yep. Add something like this to the shortcuts.xml file in C:\Documents and Settings\(username)\Application Data\Notepad++:

<Command name="Launch file" Ctrl="yes" Alt="yes" Shift="yes" Key="">&quot;$(FULL_CURRENT_PATH)&quot;</Command>

That will launch the (saved) file with its default application.

But don't edit the shortcuts.xml file with Notepad++, because every time that Notepad++ runs, it loads the contents of that file in memory, so the file is overwritten when the program shuts down. Edit the file with another program.

share|improve this answer
    
If I put that in and then start Notepad++, it's not there . –  tony_sid Aug 17 '10 at 8:50
    
Notepad++ is kinda weird about where it gets its settings. If that file didn't work, try the same file in the main Notepad++ application folder. Also, don't use Notepad++ to make the change to the file. One more thing: make sure to add the new line in the UserDefinedCommands section along with the other Command entries. –  boot13 Aug 17 '10 at 10:30
    
Is there any way of adding saving to this as well? i.e. Save file and then launch the (now saved) file with its default application? –  olagjo Feb 6 '13 at 17:05
    
@olagjo: apparently not. You should probably look at using the NppExec plugin. –  boot13 Feb 7 '13 at 11:02

I guess you mean a Plugin to execute xour commands or scripts. There is an officially supported Plugin for that on the N++ Plugindirectory called NppExec

share|improve this answer

NPPExec didn't work for me so I tried the "RunMe" plugin written by F. Stellari which works like a charm. It executes files based on their extension simply by pressing a key or a key combination.

By default RunMe is "Shift + F5" but you can easily change this to F5 changing Notepad++'s keyboard shortcut settings.

Current download url is: http://sites.google.com/site/fstellari/nppplugins

If this should change, search for "notepad++ runme"

share|improve this answer

The answer by boot13 is a little overly complicated. The Run menu and command will do this. It also has the ability to save the command with an assigned hotkey. This is then saved to the UserDefinedCommands.

The option that I prefer is the NppExec plugin. This is far more capable and flexible when choosing how to run a program, and can run things in the command line with console output as well as launching windows applications.

share|improve this answer
    
I'm glad that works for you, because any time I've tried it, the result is inconsistent. For instance, I just tried it again, and while (this time, anyway) it did add the command to the list, selecting that command does nothing at all. To avoid the frustration, I prefer showing people how to edit the file directly. –  boot13 Sep 13 '10 at 20:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.