node. JS Development Primer-notepad++ for node. js

Source: Internet
Author: User

For node. JS Development, in the case of the IDE,Webstorm is not the second choice, but it is chargeable (free to use for 30 days). First, let's start by using notepad++ to write the node. JS application. There's a big benefit to this: there's no code highlighting and auto-completion about node. js, and it's better to urge us to use the online API documentation to memorize the various class library APIs. Kill yourself, enjoy it.

Installation and configuration of notepad++

To "https://notepad-plus-plus.org/download/v6.8.2.html" here to download it, 6.8.2 version, I chose the zip package, unzip it.

From the location you extracted to find npp.6.8.2.bin This file, there is notepad++.exe this file, directly executed. You can also send a shortcut to the desktop, or add it to the taskbar.

NPP has a plug-in manager that you can open (refer to):

The effect is similar to the following when opened:

nodepad++ The new version comes with the plugin manager, what plug-ins you want to install what. Installed can click on the "Installed" tab to view, updated in the "Updates" tab, the default open available tag, below is the list you can install.

We will first install two plug-ins, one is nppexec, and the other is Jstool.

Installing Nppexec

As shown in the previous plug-in diagram, I have selected nppexec this plugin, click on the bottom right corner of the install button is OK. After the installation is successful, you may need to restart NPP. After rebooting, the Plugins menu in NPP will have one more Nppexec submenu.

Jstool the installation process is similar, do not say.

Configuring the Code AutoComplete feature

Although NPP is a small code editor, but also with the auto-completion function Oh. Can be configured via the "Settings–>preferences" menu. Reference:

Configure Nodejs in notepad++

When we use the IDE like Qt Creator or Visual Studio, it's convenient to run as a F5 or something. We have a little desire to develop Web applications based on node. JS, and the nppexec of NPP can satisfy us.

With node. JS Development, you run a project in two situations:

    1. For a simple JS file, you can perform "node Xxx.js"
    2. For express-based applications, you can perform "NPM start"

Either way, you have to run down to the command line (CMD window), which is really inefficient. Fortunately, the plug-in nppexec in NPP can configure commands and save them in scripts, add them to the macro menu as separate commands, and configure shortcut keys.

Serious reference to this article in English: Http://blog.aguskurniawan.net/post/notepadjs.aspx. Thank you very much.

Add Run Nodejs

Click the plugin->nppexec menu to do the following actions:

    • Cancel Console Command History option
    • Check Save All files on execute
    • Check follow $ (current_directory)

Then your plugin->nppexec menu looks like this:

Then click on the Execute menu in plugin->nppexec to see a dialog box similar to the following (if you have never saved a run script, you will first pop up a dialog box to select the file and cancel it):

In this dialog box, write:

cd "$(CURRENT_DIRECTORY)"node $(FILE_NAME)

Then click the Save button to save as Runnodejs:

OK, next configure the menu and shortcut keys.

Click menu plugins->nppexec->advanced Options. With the Macros submenu selected, select Runnodejs in the associated script drop-down list box and enter "Run Nodej" in the Item Name box above S ", then click the add/modify button in the lower left corner. Final Effect Reference:

Click the OK button to close the dialog box.

Finally, let's associate a shortcut key with the Run Nodejs command We just added. Click settings->shortcut Mapper ..., in the pop-up Shortcut Mapper dialog box, select Plugin commands This button to switch to the command from the plugin, To find our run Nodejs in the list, click the left mouse button (or click the Modify button at the bottom of the dialog box) and edit the shortcut in the popup dialog:

The shortcut key I set for Run Nodejs is ctrl+alt+f5.

Now you can see Run Nodejs under the Macro menu of NPP.

Open our previous helloworld.js file and press Ctrl+alt+f5 for the following results:

As shown, NPP opens a console view at the bottom of the software interface that shows the results of executing the "node Helloworld.js" output.

Add Run Npm

The steps and add run Nodejs are the same, the only thing to note is that when Nppexec executes the script, it encounters a cmd or bat command and must lose the full suffix (that is, cmd and bat cannot be omitted). Reference:

The shortcut keys I configured for run NPM are ctrl+f5. Maybe you are more inclined to F5, but F5 has been occupied by the Run command, you really want to rob, first cancel that.

Open the helloexpress example in notepad++ (see Express Installation and use ) App.js, and then press CTRL+F5 to see the following effect:

OK, now our notepad++ can be used for node. JS Development, without having to switch back and forth between the editor and the command line, feeling a little better.

Other articles:

    • Get started with node. JS-Use dialog box Ngdialog
    • Introduction to node. JS Development--Introducing Uibootstrap
    • Get started with node. JS-Transform Logindemo with MongoDB
    • node. JS Development Primer--mongodb and Mongoose
    • Get started with node. JS Development-Use cookies to stay signed in
    • Getting Started with node. JS-Using ANGULARJS built-in services
    • node. JS Development Primer--angular Simple Example
    • Introduction to node. JS Development-Using ANGULARJS
    • Getting Started with node. JS Development-Using the Jade template engine
    • node. JS Development Starter--express Routing and middleware
    • node. JS Development Primer--express Installation and use
    • node. JS Development Primer--http File Server
    • node. JS Development Primer--helloworld Re-analysis
    • Introduction to node. JS Development--Environment building and HelloWorld

Copyright NOTICE: This article is Foruok original article, without BO Master permission cannot reprint.

node. JS Development Primer-notepad++ for node. js

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.