Notepad++ Tips & Features You Might Not Know

Previously we have discussed the best Notepad++ Plugins, today we’ll discuss some of the important features of Notepad++ that can accelerate and improve our coding. If you have already used Notepad++ for quite times may be you has not been some of these features, so let’s see together…

1. Go To Line

As a developer, sometimes line numbers of code will be so important, especially when debugging programs like PHP and JavaScript, because, when an error occurs, the program will usually tell what is the line number that causes the error.

For instance, PHP Error:

Knowing The PHP Script Error

or Javascript Error:

Knowing Javascript Error

Moreover, when we inspect an HTML element and want to change the style, the first time we do is look at the number of the row.

Knowing Line Number of CSS Code

Important right? so to use this feature, simply press Ctrl+G on your keyboard and fill the row number that you want to jump to and then click OK.

2. Reverse Indent / Back Tab

In order to make the code readable and neat, we’ll often make indent by pressing the Tab key, but how to get it back? it’s easy, just press the Shift + Tab key in the highlighted code.

Notepad++ Tips - Backtab or Reverse Indent

3. Single Line Comment / Uncomment

To commenting a line of code, we usually add double slash marks (//) at the beginning of the line, in Notepad++, this can easily achieved by just pressing the Ctrl+K or Ctrl+Q key.

Personally, I prefer using Ctrl+Q as it can be done with one left hand, so it’s easier than Ctrl+K.

To restore it, press Ctrl + K or Ctrl + Q once again.

Notepad++ Tips - Single Line Comment

4. Block Comment/Uncomment

Block comment is usually done by putting a /* sign at the beginning and closing with */, on the HTML document, these signs would be <!– and –>, using notepad++, this task can be achieved by selecting row that we want to add a comment sign and pressing the Ctrl+Shift+Q key.

Notepad ++ will adjust the sign according to the existing file type.

Notepad++ Tips - Block Comment

How to Reserve?

To reverse it back, we CAN NOT repress this shortcut once again, as we did on the single line comment, however, we have to define the shortcut manually, it can be done by opening the menu: Run>Modify Shortcut/Delete Command…

Next, navigate to Main Menu tab, find the line number “46. Uncomment block”, then enter the desired shortcut, I prefer to use the Crtl+Shift+W key as it easily operated with one left hand.

Notepad++ - Block Uncomment

5. Column Selection

Like other code editors, Notepad ++ can also select multiple lines at once, how to do is press and hold the Alt key, then select rows that you want to edit. This feature typically useful when we edit csv files or change a text-table into a csv file.

Notepad++ Tips - Column Selection

TIPS

For selecting of a long text, (1) press and hold the ALT key then click on the text you want to be used as the initial selection, (2) use the mouse to scroll down the windows, (3) press the SHIFT key (keep ALT key pressed) then click on the text used as the end of the selection.

6. Auto Completion

This feature is useful to give a closing character for certain ones, by default Notepad ++will automatically close for opened parentheses (), brackets [], and braces {}, in addition, you can also add another character e.g. two quotation marks “” or single quotation marks “, just go to the settings menu, then choose Preferences > Tab Auto Completion.

Notepad++ Tips - Auto Completion

7. Adding and deleting the line numbers

Suppose we have multiple lines of code or lists that need to be added a line number at the beginning of each line, to do this, make some selection then open the “Column/Multi-Selection Editor” window by navigating the menu to: Edit>Column Editor… or by using a shortcut Alt+C, then fill in the parameters.

Notepad++ Tips - Add Line Number

Deleting line numbers

While copying and pasting codes or articles from other sources, sometimes there is an ordinal number in the beginning of each line, Notepad++ provide features to eliminate it, to do so, make some selection and go to menu: TextFX>TextFX Tools>Delete Line Numbers or First Word

Notepad++ Tips - Deleting Line Number

8. Deleting Blank Lines

Same as previous, when copying and pasting codes or text from other sources, sometimes there are some blank line between rows, while sometimes there is also an extra space at the end of each line, to eliminate all of these, use TextFX>TextFX>Trim Trailing Spaces and TextFX>TextFX>Edit Delete Blank Lines

Notepad++ Tips - Deleting Blank Lines

9. Move the lines

To shift up lines, first select it and press Ctrl+Shift+Up key while shift down the lines use Ctrl+Shift+Down

Notepad++ Tips - Moving Lines

10. Line up multiple lines

To line up multiple lines by equal sign, first, make some selection, then run TextFX > TextFX Edit > Line up multiple lines by (=), for other characters, first you need to copy it then run TextFX > TextFX Edit > Line up multiple lines by (Clipboard Character)

For more possible options, use Code Alignment Plugin

Notepad++ Tips - Line up multiple lines

11. Save and Load Session

When working with multiple files at once e:g a file HTML + JavaScript + CSS, it will be troublesome if we have to open and close it manually, Notepad ++ provides a feature called “Session”, which allows us to save and open multiple files at once. These features can be accessed through the File>Load Session or Files>Save Session

Notepad++ Tips - Save an Load Session

12. Compare File – Synchronize Scrolling

As we’ve discussed before, notepad ++ has a plugin that will compare two files and give a particular color on different lines, actually, Notepad++ has built-in features that exactly do the same things.

How to do it?

Right click on a specific tab then select “Move to Other View”, next, click on the View menu, select Synchronize Vertical Scrolling and Synchronize Horizontal Scrolling.

Notepad++ Tips - Compare Files

Notes: To revert it back, simply click and drag the tab back to its original position.

13. Displaying Tab, Spacebar, and Enter in Notepad ++

Have you ever confused distinguish between spaces and tabs? or maybe with the enter key too? If yes then “Show All Characters” is the solution, this feature will display the symbol characters, such as TAB (Arrow), SPACE (Dot), and ENTER (LF-Line Feed) and/or (CR-Carriage Return).

CRLF and LF used by windows operating systems, while the CR for the Linux.

To enable this feature, navigate to the menu: View>Show Symbol>Show All Character or via the icon menu on the toolbar.

Show All Character Icon Menu

Result:

Notepad++ Tips - Displaying Tabs and Enters Character

14. Removing Tab and Enter Character

Like other code editors, Notepad++ is also able to find and replace special characters, such as tab and enter. To use this feature, go to Find & Replace” menu or press CTRL+H, in the “Search Mode” section, select Extended (\n,\r,\t,\ 0,\x, …).

NOTES

Important to note that to remove spaces, tabs, or enter (CR and LF), you want to enable “Show All features” feature which we have discussed previously, so it’s easy to identify the space, TAB, CR, and LF.

to eliminate the “enter” character, use \r for CR and \n toLF, while \t for Tab Character.

Notepad++ - Deleting Tabs and Enters

BONUS

15. Launch In Browser

Another useful feature is Launch in Browser, which automatically run a browser to display the code we’re made, simply click the Run menu, then select the desired browser.

Notepad++ Tips - Launch In Browser

If your desired browser is not listed, you can define your own by selecting the “Run…” sub menu, then select the browser’s executable (.exe) file, this -optionally- can be stored as a shortcut by clicking the Save… button

16. Tab Management

In Notepad ++, opened documents organized into tabs which by default placed underneath the toolbar, if the tabs exeed the available area, then Notepad++ will hide the rest and show left-right arrows, it will make more difficult finding the tabs.

Notepad++ - Single Line Tab

This can be overcome by arranging the Tab into multi-line, to do so, open the menu: Settings>Preferences, then select the “General” tab, in the “Tab Bar” Section, check “Multi-line” option.

In addition, there are other interesting options you want to give a try, such as “Show close button on each tab” or “Double click to close document”

Notepad++ - Multi Line Tab

There is another alternative option which will display the opened document as a list, check this out: Window Manager Plugin

17. Language Selection

Notepad++ will give a different color for a particular piece of code (Class, Function, Variable, String, Numeric, etc), which are usually called Syntax Highlighting. Notepad ++ will automatically adjust it’s color according to the type of (PHP, JS, CSS, HTML, etc), however, you can define your own through the language menu.

Notepad++ tips - Syntax Highlighting

18. Plugins

There are a lot of plugins that useful to enhance our Notepad++, such as Code Alignment, NppFTP, Finger Text, NppExport, and  JSTools too long, these plugins are discussed separately in the following articles: Best Notepad ++ Plugin – A Complete List

3 Responses

Leave a comment

Like Us

Social