Getting started with Node. js development-notepad ++ for Node. js and node. jsnotepad

Source: Internet
Author: User

Getting started with Node. js development-notepad ++ for Node. js and node. jsnotepad

For Node. js development, IDE,WebstormIt is the best option, but it is charged (free for 30 days ). In the first place, we will useNotepad ++To compile the Node. js application. There is another major benefit to doing so: Without code highlighting and auto-completion for Node. js, we can better urge us to use the online API documentation to remember various class library APIs. Stop yourself, enjoy it.

Notepad ++ installation and configuration

To"Https://notepad-plus-plus.org/download/v6.8.2.html"Download it here. For version 6.8.2, I chose a zip package and decompress it.

Find the npp.6.8.2.binfile from the address you have extracted. The file notepadcmd.exe is included and can be directly executed. You can also send a shortcut to the desktop or add it to the taskbar.

Npp has a plug-in manager, which can be opened as follows (reference ):

After opening, the effect is similar to the following:

The new version of Nodepad ++ comes with the plug-in manager. You can click the "Installed" tab to view the information that has been Installed. If there are Updates under the "Updates" tab, the default "Available" tab is opened. Below is the list that you can install.

We will first install two plug-ins: NppExec and JSTool.

Install NppExec

As shown in the previous plug-in diagram, I have selected the NppExec plug-in and click the Install button in the lower right corner. After the installation is successful, you may need to restart npp. After the restart, an NppExec sub-menu will be added to the npp Plugins menu.

The Installation Process of JSTool is similar.

Configure the code auto-completion Function

Although npp is a small code editor, it also provides the Automatic completion function. You can use the "Settings-> Preferences" menu to configure the Settings. Refer:

Configure Nodejs in Notepad ++

When using the IDE such as Qt Creator or Visual Studio, we can Run by F5 or something, which is very convenient. We have such a small wish to develop Web applications based on Node. js that npp NppExec can satisfy us.

You can use Node. js to develop and run a project in two cases:

Either way, you have to run to the command line (cmd window), the efficiency is indeed not high. Fortunately, npp plug-in NppExec can configure some commands, save these commands to the script, add them to the Macro menu for separate command execution, and configure shortcuts.

For more information, see http://blog.aguskurniawan.net/post/notepadjs.aspx. Thank you.

Add Run Nodejs

ClickPlugin-> NppExecMenu to perform the following actions:

  • CancelConsole Command HistoryOption
  • SelectedSave all files on execute
  • SelectedFollow $ (CURRENT_DIRECTORY)

Then yourPlugin-> NppExecThe menu looks like this:

ClickPlugin-> NppExecInExecuteMenu, you can see a dialog box, similar to the following (if you have never saved a running script, a dialog box for selecting a file will pop up and cancel it ):

In this dialog box, write:

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

Then clickSaveButton to save as RunNodejs:

Now, configure the menu and shortcut keys.

Click menuPlugins-> NppExec-> Advanced Options. SelectedPlace to the Macros submenu, InAssociated scriptSelect RunNodejs from the drop-down list box, enter "Run Nodejs" in the edit Item name box above, and clickAdd/ModifyButton. Final result reference:

ClickOKButton to close the dialog box.

Finally, let's addRun NodejsCommand to associate a shortcut key. ClickSettings-> Shortcut cut Mapper...In the displayed Shortcut mapper dialog box, selectPlugin commandsClick this button to switch to the command from the plug-in, find our Run Nodejs in the list, and double-click the left mouse button (or clickModifyIn the pop-up dialog box, edit the shortcut key:

The shortcut key I set for Run Nodejs is CTRL + ALT + F5.

Now you can see Run Nodejs under Macro menu of npp.

Open the HelloWorld. js file and press CTRL + ALT + F5. The effect is as follows:

As shown in, npp opens a Console view at the bottom of the software interface, which displays the output result of executing "node HelloWorld. js.

Add Run Npm

The steps are the same as to add Run Nodejs. The only thing to note is that NppExec must enter the full suffix when executing the cmd or bat command (that is, cmd and bat cannot be omitted ). Refer:

The shortcut for configuring Run Npm is CTRL + F5. Maybe you prefer F5, but F5 has been occupied by the Run Command. If you really want to grab it, cancel it first.

Open the HelloExpress example in Notepad ++ (seeInstallation and Use of Express), And press CTRL + F5 to see the following results:

Now, our Notepad ++ can be used for Node. js development. You don't have to switch back and forth between the editor and the command line. It feels a little better.

Other articles:

  • Getting started with Node. js Development -- use the ngDialog dialog box
  • Getting started with Node. js Development -- introducing UIBootstrap
  • Getting started with Node. js development-using MongoDB to transform LoginDemo
  • Getting started with Node. js development-MongoDB and Mongoose
  • Getting started with Node. js development-Keep logging on with cookies
  • Get started with Node. js development-use AngularJS built-in services
  • Get started with Node. js development-Angular simple example
  • Get started with Node. js development-use AngularJS
  • Getting started with Node. js Development -- using the jade template engine
  • Introduction to Node. js development-routing and middleware in Express
  • Getting started with Node. js development-install and use Express
  • Node. js development-HTTP File Server
  • Getting started with Node. js Development -- HelloWorld Analysis
  • Node. js development entry-Environment setup and HelloWorld

Copyright Disclaimer: This article is an original foruok article and cannot be reproduced without the consent of the blogger.

Related Article

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.