Notepad++ Hidden Tricks: Column Mode, Macros and Multi-Editing

Seven power moves that turn the free editor into a text-crunching machine, no coding degree required.

FREE$34.95UpdateStar PremiumShare a link to claimSomebody just sent you a list of 500 email addresses, half of them duplicated, all of them in the wrong format, and your boss wants it cleaned up "real quick". You could spend the afternoon clicking and typing. Or you could open Notepad++, the free editor that quietly ships with features most people never discover. Before you start, make sure you're on version 8.9.8.1 or later: the September releases closed a whole batch of security holes, so update via ? > Update Notepad++ if you haven't yet.

Trick 1: Select columns instead of lines

Normal selections run from left to right, line by line. Column mode selects a rectangle, which is perfect for tables, logs and lists with fixed widths.

  1. Hold Alt and drag with the mouse across the area you want.
  2. Or keep your hands on the keyboard and press Alt+Shift together with the arrow keys.
  3. Now type, delete or paste, and the change happens on every selected line at once.

Press Esc to leave column mode. This is the fastest way to delete a column of timestamps from a log or add a prefix to fifty lines.

Trick 2: Number lines automatically with the Column Editor

Need to turn a plain list into a numbered one, or generate IDs from 1001 upwards?

  1. Place the cursor at the start of the first line, then column-select down through all lines with Alt+Shift+Down.
  2. Open Edit > Column Editor... or press Alt+C.
  3. Choose Number to Insert, enter an Initial number, set Increase by to 1 and pick Zeros under Leading if you want 001, 002 and so on.
  4. Click OK.

The Format option even lets you count in hexadecimal or binary, which developers will love.

Trick 3: Edit in many places at once

Multi-editing works like column mode, but your cursors can be anywhere. Hold Ctrl and click to place additional cursors, then type. Hold Ctrl while dragging to add extra selections. It's switched on by default. If it doesn't work, check Settings > Preferences > Editing 2 and make sure Enable Multi-Editing is ticked.

Trick 4: Clean up lists in two clicks

Back to that messy email list. Notepad++ has a whole menu for jobs like this under Edit > Line Operations:

  • Remove Duplicate Lines deletes every repeated line, not just neighbours.
  • Remove Empty Lines gets rid of blank gaps. The variant Remove Empty Lines (Containing Blank characters) also catches lines with only spaces.
  • Sort Lines Lexicographically Ascending sorts alphabetically.

A word of warning about sorting: "lexicographically" means by character code. Uppercase letters land before lowercase ones, and "10" comes before "2". For numbers, use Sort Lines As Integers Ascending instead.

Two more keyboard heroes: Ctrl+D duplicates the current line (or the selection), and Ctrl+Shift+Up or Ctrl+Shift+Down moves the current line up or down.

Trick 5: Filter huge logs with Mark and bookmarks

Want only the lines that contain "ERROR" from a 20,000-line log file? Don't scroll, filter.

  1. Open Search > Mark... or press Ctrl+M.
  2. Enter your search term and tick Bookmark line.
  3. Click Mark All. Every matching line gets a bookmark in the margin.
  4. Now open Search > Bookmark and choose Copy Bookmarked Lines to grab them, or Remove Non-Bookmarked Lines to delete everything else.

Switch Search mode to Regular expression for advanced patterns, and use Search > Find in Files... (Ctrl+Shift+F) to search an entire folder at once. If you remove lines by mistake, Ctrl+Z brings them back.

Trick 6: Record a macro for repetitive edits

When the same sequence of keystrokes has to happen on every line, let Notepad++ repeat it for you.

  1. Put the cursor at the start of the first line.
  2. Press Ctrl+Shift+R to start recording.
  3. Perform the edit once, for example Home, type a quote mark, End, type a quote mark and a comma, then press the Down arrow and Home again.
  4. Press Ctrl+Shift+R again to stop.
  5. Test it with Ctrl+Shift+P, then run it on the rest of the file via Macro > Run a Macro Multiple Times... and choose Run until the end of file.

Like your macro? Save it with Macro > Save Current Recorded Macro... and give it a name and shortcut. It will show up in the Macro menu forever.

Trick 7: Never lose unsaved text, and compare files

Notepad++ quietly protects you from crashes and accidental closing. Under Settings > Preferences > Backup, the options Remember current session for next launch and Enable session snapshot and periodic backup are on by default. That's why you can close the editor with unsaved tabs and find them all again next time. The backups live in %AppData%\Notepad++\backup, which is good to know if your PC ever crashes.

To see what changed between two versions of a file, install a compare plugin:

  1. Open Plugins > Plugins Admin....
  2. On the Available tab, search for ComparePlus, tick it and click Install.
  3. Open both files, then choose Plugins > ComparePlus > Compare or press Ctrl+Alt+C.

Differences are highlighted side by side. It's a lifesaver for config files and contracts.

Cheat sheet: the shortcuts from this guide

ShortcutWhat it does
Alt + dragColumn selection with the mouse
Alt+Shift+Arrow keysColumn selection with the keyboard
Alt+CColumn Editor (insert text or numbers)
Ctrl + clickAdd another cursor
Ctrl+DDuplicate line or selection
Ctrl+Shift+Up/DownMove the current line
Ctrl+MMark (and bookmark) matches
Ctrl+Shift+FFind in Files
Ctrl+Shift+RStart or stop macro recording
Ctrl+Shift+PPlay back the macro
Ctrl+Alt+CCompare two files (ComparePlus plugin)

Our verdict

Notepad++ is far more than a replacement for Windows Notepad. Office workers cleaning lists, admins reading logs and developers editing code all save real time with these tricks. If you learn one thing today, make it Alt+drag column selection. You'll wonder how you ever lived without it.

Related on UpdateStar

about author