Notepad++

Software Introduction

Notepad++ is a text editor for the Windows operating system. It supports highlighting and completion for multiple languages, multiple encodings, and multiple programming languages. Its logo is also very cute: it is a chameleon (
npp-logo
npp-logo
)

Its functionality is much more powerful than that of many other editing programs. It is more stable when opening large files, and repeatedly undoing does not cause problems. You do not need to save when closing it either; it automatically saves your work in the buffer. (This may require configuration.) Moreover, it is very compact, at only 10MB+, and can even be carried around on a USB flash drive.

Download and Installation

See Getting started | Notepad++ User Manual.

Changing the Interface Language

npp-lang
npp-lang

Once the language has been changed, you can modify the editor however you like!

Basic Usage

This section mainly covers some basic and distinctive features.

Find and Replace

Click 「(menu bar) Search」 -> 「Find」 in sequence (shortcut CTRL+F) to open the 「Find」 page (as shown below).

npp-search
npp-search

Click 「(menu bar) Search」 -> 「Replace」 in sequence (shortcut CTRL+H) to open the 「Replace」 page (as shown below).

npp-replace
npp-replace

Find and Replace are actually in the same window; click the tabs above to switch between them.

Their functionality is broadly similar to that of ordinary editors, but they support more features, such as:

  1. Strict matching or case-sensitive matching.
  2. Matching across documents.
  3. Escape characters, such as '\r' and '\n'.
  4. Regular expressions.
  5. Counting.

Periodic Backup

npp-settings-1
npp-settings-1

With this feature, you do not have to worry about losing code due to accidents!

However, this feature only takes a snapshot of your file; it does not truly save it, so it is still recommended that you develop good saving habits. Alternatively, you can install the "Auto Save" plugin from the built-in plugin store (see Advanced Usage -> Plugins, as below).

Bookmarks

Press Ctrl+F2 on the line you need to place or remove a bookmark. A blue dot appears at the beginning of a line with a bookmark.

Press F2 to jump to the next bookmark.

If you find this inconvenient, you can install the "Bookmarks" plugin from the built-in plugin store.

Code Highlighting

Right-click "XXX file" in the lower-left corner to choose highlighting for many languages, including C, C++, PASCAL, and Markdown. You can even define your own highlighting!

If you think changing the highlighting every time you open a file is troublesome, you can change the default highlighting in 「Settings -> Preferences -> New Document -> Default Language」.

If you need to render Markdown, you can install "Markdown Viewer" from the plugin store. There are many more similar plugins waiting for you!

Show All Characters

npp-settings-2
npp-settings-2

Click the button circled in red to display previously invisible characters such as 「spaces」, 「TAB」, and 「line breaks」 very (za) cle(ar)arly (zhang).

Automatically Detect File Encoding and Line Endings

Notepad++ can automatically detect whether the current file encoding is UTF-8, GB2312, or even another encoding. You no longer need to worry about being beaten to death by 锟斤拷 or scalded to death by 烫烫烫.

To browse an article using a different encoding, click 「(top menu bar) Encoding」 -> 「Encode in XXX」 in sequence. To change a file's character encoding, click 「(top menu bar) Encoding」 -> 「Convert to XXX」 in sequence.

It can also automatically detect whether line endings are CR, LF, or CRLF. You do not need to worry about line endings being swallowed from downloaded data.

In the bottom status bar, you can see text such as "Windows(CR LF)"; this is the line ending of the current file. Right-click it to change the line ending of the current file. This operation is even more intuitive when combined with 「Show All Characters」!

Advanced Usage

This section is for users with more demanding needs.

Macros

Macros can help you complete many repetitive tasks. For example, changing 「abcde」 to 「afce」 on odd-numbered lines takes two steps.

Recording a Macro

npp-macro-rec
npp-macro-rec

Using a Macro

npp-macro-use
npp-macro-use

Processing Many Lines and Reusing It

What if there are more lines? The operation needs to be changed slightly.

First, when recording, be sure to press the HOME or END key on the keyboard to move the cursor to the beginning or end of the line, then use the arrow keys to adjust its horizontal position before making the change. Finally, be sure to use the arrow keys to move the cursor to the next line to process.

For example, in the previous example, you can first press END, then press ←, Backspace, ←, Backspace, and F in sequence, and finally press ↓ twice before stopping the recording.

Then replay it: first move to the first line to process (line 3), then click 「Macro」 -> 「Run a Macro Multiple Times」. In the pop-up window, set the macro to run (the one just recorded is generally the first), set the number of runs (or run directly to the end of the file), and click OK.

Saving a Macro

Click 「Macro」 -> 「Save Current Recorded Macro」 and set its name and shortcut to save it for later use.

Plugins

Plugin Management

Open the 「Plugins」 button on the function bar; the list displays all plugins you have installed.

Then select the 「Plugin Admin」 option to manage your plugins.

Installing a Plugin (Store)

  1. Open the 「Available」 tab and check the plugin you want in the list.
  2. Click the 「Install」 button in the upper-right corner and restart the software as prompted.

Installing a Plugin (Manually)

  1. Download the plugin (official address hosted by a third party: https://sourceforge.net/projects/npp-plugins/). Be sure to choose a plugin with the same processor architecture as the one used when installing Notepad++.
  2. Find a file named "XXX.dll" (usually named after the plugin).
  3. In Notepad++, click Plugins in the function bar, then click 「Open Plugins Folder」 in the list.
  4. Put the DLL file you found into the folder and restart Notepad++.
  5. [Optional] Delete the file you just copied, but do not delete the generated folder!

Tips: If it fails several times, try creating a folder with the same name as the plugin and putting the ".dll" file into the created folder.

Updating Plugins

In Plugin Admin, select the 「Updates」 tab, check the plugins to update, and click the 「Update」 button in the upper-right corner.

Removing Plugins

Likewise, in Plugin Admin, select the 「Installed」 tab, check the plugins to remove, and click the 「Remove」 button in the upper-right corner.

Setting Up a Development Environment

It is more than just an editor! "Notepad++" is practically magical: it can compile code in a foolproof way and even replace an IDE! Here, C++ is used as an example.

  1. Install a compiler and add its necessary file directory to the PATH environment variable. (C++ needs %APPPATH%\bin added.) When entering g++ in cmd no longer results in the message 'g++' is not recognized as an internal or external command... you are ready (you may need to restart the computer in between). Download ConsolePauser is recommended; place it anywhere and add its directory to the environment variables (it is a Dev-C++ plugin and is also present in the Dev-C++ software root directory).

  2. Select 「Run」 -> 「Run...」 from the menu bar to open the 「Run」 window.

  3. Enter the following commands separately:

    #Compilation command:
    cmd /c g++.exe -o $(CURRENT_DIRECTORY)\$(NAME_PART).exe $(FULL_CURRENT_PATH)
    #Run command:
    cmd /c $(CURRENT_DIRECTORY)\$(NAME_PART).exe $(FULL_CURRENT_PATH) & pause
    #Debug command:
    cmd /c gdb $(CURRENT_DIRECTORY)\$(NAME_PART).exe
    
    #If ConsolePauser was downloaded, the following commands can provide a better program-running experience! (Remember to add the environment variable!)
    
    #Compilation command:
    cmd /c (start ConsolePauser "g++.exe -o $(CURRENT_DIRECTORY)\$(NAME_PART).exe $(FULL_CURRENT_PATH)")
    #Run command:
    cmd /c (start ConsolePauser "$(CURRENT_DIRECTORY)\$(NAME_PART).exe")
    #Debug command:
    cmd /c (start ConsolePauser "gdb $(CURRENT_DIRECTORY)\$(NAME_PART).exe")
    
  4. Click 「Save」. You can choose the name, such as "Compile" or "Run", and then set your preferred shortcut (choose memorable ones, such as F9 and F10 for Dev-C++).

  5. Enjoy it!

Easter Eggs

  1. When running the installer, you will see the following sentence at the bottom:

    "The best things in life are free. Notepad++ is free. So Notepad++ is the best(.)"

    (The best things in life are free. Notepad++ is free. So Notepad++ is the best.)

    That is quite a boast, but it certainly has the confidence to back it up.

  2. Enter "random" and select it on a newly opened page, then press F1 to get a very interesting sentence.

This content comes from OI Wiki: Notepad++. See the original for authors and revision history. AIOJ has adapted the formatting, in-site links, and resource paths.

Content is shared under CC BY-SA 4.0 and SATA license; additional terms are governed by the original notice. Thanks to the OI Wiki authors and contributors; per the SATA terms, please visit the OI Wiki repository and star it to show your support.