Configure Notepad++ for Nodejs

by Agus Kurniawan 27. April 2012 04:30

Nodejs_logo_light

Notepad++ is a great text editor for Windows that you can integrate many compilers inside. Now, I would like to share how to configure Notepad++ to run Nodejs code.

Nodejs

You could download and install Nodejs for Windows OS at http://www.nodejs.org . Just follow the installation instructions.

Configure Nodejs In Notepad++

Firstly, you must install NppExec plugin. You do it with clicking menu: Plugins->Plugin Manager->Show Plugin Manager. On Available tab, install NppExec plugin. If success, you should it on Installed tab, see picture below

n1

Click Close button to close this dialog.

Now, you configure NppExec plugin. Click menu Plugins->NppExec and do

  • unchecked Console Command History
  • checked Save all files on execute
  • checked Follow $(CURRENT_DIRECTORY)

n2

Then, click Execute and you’ll see a dialog as below

n3

Write this script inside edittor

cd "$(CURRENT_DIRECTORY"
node $(FILE_NAME)

Click Save button and save as Run

n4

Now, you should configure for menu shortcut. Click menu Plugins->NppExec –>Advanced Options

n5

Checked Place to the Macros submenu. Choice Run on Associated script and write Run Nodejs. Then click Add/Modify button. Close this dialog by clicking OK button.

Then, you configure Macro shortcut menus. Click Settings –> Short Mapper

n6

Click Plugin commands. Find Run Nodejs in Name column. Click Modify button

n7

For instance, shortcut for Run Nodejs is CTRL+F5.

Now you should see your Run Nodejs menu under Macro as below

n8

Testing

Write simple Nodejs code here

console.log('welcome to my nodejs');

To run this code, click menu Macros –> Run Nodejs or your shortcut key (for example: CTRL+F5). Then you should the result  as below

n9

Tags:

Comments (14) -

business directory
business directory United States
5/15/2012 6:09:00 AM #

Again, exceptional post. You know, I am absolutely happy I came across this. I'll tweet this blog so my buddies can read your writing too!

Salesforce polska
Salesforce polska Poland
6/4/2012 2:55:04 AM #

"Welcome  to my nodejs" is what I've got after you blog Smile

KS
KS United States
6/15/2012 12:25:51 PM #

Can you explain how to set up syntax highlight and autocompletion?

KS
KS United States
6/15/2012 12:26:27 PM #

can you show how to set up syntax highlight and autocompletion?

Ajay
Ajay India
6/28/2012 7:05:24 PM #

cd "$(CURRENT_DIRECTORY" is taking the "Installation directory" of Notepad++ and not the one where I have stored my "sample.js" Node program file.

Which env variable I should use so that it takes the the current file from the directory where it is saved?

Ajay
Ajay India
6/28/2012 7:17:31 PM #

I just restarted Notepad++ and it started working Smile. Thanks.

Dhananjay Prajapati
Dhananjay Prajapati United States
9/21/2012 9:54:14 AM #

Nice and  very very helpful  posting .. thanks bro ...

Bill Matson
Bill Matson United States
11/6/2012 9:45:00 PM #

Helpful post, here's another idea....how about launching the debugger too.  Assuming that you have node-inspector installed:

cd "$(CURRENT_DIRECTORY"
npp_run node-inspector
node --debug-brk $(FILE_NAME)

This will launch the node-inspector app in a separate window before launching the file in the editor.  Change --debug-brk to just --debug if you don't want a breakpoint on the first line.  The using a webkit browser, go to http://127.0.0.1:8080/debug?port=5858 to access the debugger.

Jone Polvora
Jone Polvora Brazil
2/24/2013 6:02:03 PM #

Very nice! Thanxs

Jone Polvora
Jone Polvora Brazil
2/24/2013 6:02:37 PM #

Very nice post. Thanks for the tip.

Sai K
Sai K United States
3/16/2013 11:02:49 AM #

Works Great, Awesome Tip. Thanks

Novahoo
Novahoo Russia
4/1/2013 12:25:58 AM #

tnx

Dave
Dave United States
4/5/2013 10:31:52 AM #

Great post. Thanks!

Neil Hathaway
Neil Hathaway United Kingdom
6/5/2013 6:36:27 PM #

Brilliant !

Thanks for the heads up.

About Agus Kurniawan

Agus Kurniawan

For more detail about me click here [V]

Please entry your name into my guestbook [V]

If you want to contact me, please go here [V]

My Books

Pocket Reference: Netduino for Beginner Database Programming using Matlab

Pocket Reference: Basic Sensors in Windows 8 Getting Started with Matlab Simulink and Raspberry Pi

Getting Started with Arduino and Java  Pocket Reference: Raspberry Pi Programming

Getting Started with Arduino and Matlab Getting Started with Arduino and .NET

Pocket Reference: Raspberry Pi Getting Started with Arduino and Node.js

MongoDB for VB.NET Panduan Praktis Windows Azure

Network Forensics: Panduan Analisis Dan Investigasi Paket Data Jaringan Menggunakan Wireshark Object-Relational Mapping (ORM): MongoDB, Mongoosejs and Node.js By Example

Nodejs Programming by Example MongoDB for by Example

Pemrograman Parallel Dengan MPI dan C Panduan Lengkap iPad 2 Untuk Pemula

Pemrograman Jaringan Dengan Java Aplikasi Pilihan iPad Untuk Anak-Anak

Buku lainnya [V]

Agus Kurniawan is Microsoft MVP (Most Valuable Professional)

Follow Me

Follow agusk2010 on Twitter

Month List