Notepad++

Notepad++ is a free and open-source text editor for Windows, and a great substitute for the standard text editor that ships with Windows. It’s packed with features, and supports 3rd party plugins — the following are some notes about features I find come in handy.

I have limited experience with keyboard-driven editors like Vim and Emacs. These may cover the same functionality, and more — I don’t really have the experience to say. In any case, I think NP++ strikes a nice balance between features and accessibility in a Windows environment.

 

Block Editing

To highlight 2D blocks of characters, hold SHIFT + ALT and move the cursor with the arrow keys. Alternatively, hold ALT, and then click and drag the mouse cursor. You can copy and paste blocks, and insert and delete characters along multiple lines. Two use cases are 1) to insert new columns or ASCII separators into tables, or comment out a multi-line block of code, and 2) to block-copy and paste boxes and other shapes in ASCII diagrams.

npp_block_edit1 npp_block_edit

 

Find (in files)

Notepad++ allows for searching within the current document, among all currently opened docs, and within a directory path. There are three search modes: one that uses normal / literal words and phrases, one with an extended parsing mode that includes escaped characters, and one with Regular Expressions. For in-depth log analysis, you are better off using the proper command line tools,  but Notepad++ can still be useful for quick searches. My experience is that it has trouble with stability when opening and searching 100+ megabyte files.

The search results are shown in a horizontal pane. Double-click a result line to open the document at that line number. These results can also be copied and pasted into a new document and be searched through.

npp_search1 npp_search2

 

Configure Notepad++ to use spaces instead of tab characters for Python only

Select Settings -> Preferences and choose Tab Settings.

Select from the list box, select ‘[Default]‘ :

  • Uncheck ‘Replace by space

From the list box, select ‘python‘ :

  • Uncheck ‘Use default value
  • Set tab size to your preference (I use 4)
  • Check ‘replace by space

Close the settings box. This change takes effect immediately, but does not apply retroactively. To convert tabs to spaces in an existing py source file, you can select Edit -> Blank Operations -> TAB to Space.

 

Enable the Documents sidebar

(If you do not see the options below, try upgrading to the latest version of Notepad++. I have this set up in v6.9.2 as of 13/Aug/2016.)

The file list can be enabled here (Settings -> Preferences -> General -> Document List Panel: Check Show. Optionally disable extension column for a cleaner look.) :

npp_file_list

 

Save document state on exit

This can be configured within Settings -> Preferences -> Backup.

  • Check Remember current session for next launch.
  • Check Enable session snapshot and periodic backup.

Unsaved files will be saved to the below directory when you exit NPP. They will be restored when you start the program again.

npp_remember_session_on_close

Some caveats with this feature:

  • If Notepad++ crashes, the files may remain there without being cleaned up. They could also be corrupted and lost if it can’t recover gracefully (let’s say you did a Find in Files search and Notepad++ croaked in the process).
  • Be careful not to leave sensitive notes in unsaved files when you close Notepad++, because they will be saved straight to disk with no encryption.

(edit 10/30/16: wording)

Leave a Comment