Notepad++ Secrets: Tabs

© 2012, Martin Rinehart

The "Tab" key is special. Press it at the left of a line and programmer's editor Notepad++ indents the line. Shift+Tab, at the left, exdents. Highlight a group of lines and Tab (or Shift+Tab) indents (or exdents) the group. Nice.

Tab Choices

If you want to share your source files with others who may use different tab sizes, some recommend that you replace your tab characters with spaces. For this, use the Settings/Preferences... dialog, "Language Menu/Tab Settings" tab (it's really two separate dialogs on one tab):

Replacing HTML tabs with 4 spaces.

We're big fans of tabs, not spaces. We would never check the "Replace by space" box. Our option is to replace others who don't use standard four-space tabs with standards-loving friends. With tabs, a single backspace does the work of four backspace presses (or one Tab+Shift—it requires a complex keyboard dance).

If you are a tab fan, you'll want to see your tabs.

Viewing Tab Characters

Notepad++ makes it easy to see your in-file tab characters, so you always know what you've got and what to expect. Use the View/Show Symbol submenu:

Choosing to view tab characters in yor files.

With that option selected, Notepad++ will show your tabs as modest red arrows.

Viewing tab characters in yor files.

Remember that those red arrows do not change your file's content. In the alt= line above you have two tab characters (as escape characters in regex those are written \t\t) followed by alt=....

If you choose "Extended" or "Regular expression" as the "Search Mode" in the Find/Replace dialog, you can use \t to find (or replace with) tab characters. If you use the Backspace or Delete key once, you delete a single tab. Your text shifts as if you had deleted multiple spaces.

A word of warning: Edit / Blank operations, "TAB to Space" and "Space to TAB" are not our favorites. We prefer to use the "Replace" dialog to convert four spaces to a single tab, or vice-versa.

Feedback: MartinRinehart at gmail dot com.

# # #