In this post - Notepad++ Tips, Tricks, Hints:

  • Block selection
  • Search regex, multiple files, count
  • Remove empty lines
  • Compare
  • Plugins
  • Keyboard tricks

Notepad++ Tips, Tricks, Hints

There are plenty of IDE-s and text editors available. The one that is very popular in IT people is Notepad++. It is portable, free, user-friendly and very light but feature-rich. The supported platforms are limited to windows but with some tricks can be run on Linux as well. Notepad++ support variety of different languages including .html, .css, .c, .c++, .java, .bash, .js, and more. You can define your own language if you need as well and customize the application depending on your needs.

Block selection

Very useful feature if you need to extract a column or block of information. You need to press and hold ALT and do a selection with the mouse.

Example:
If you need to extract a column from a text file then:

  • place the cursor at the beginning of the tool
  • press ALT
  • press mouse button 1 and keep
  • move to the end of the block

Search regex, multiple files, count

Searching option are very powerful with Notepad++. It's really easy to use and relatively fast for big files

  • Find- simple find - use CTRL+F for find menu and F3 for next occurrence (when you close the find dialog)
  • Count- count all matches
  • Find All in All Opened Documents - You can search in multiple files very easy.
  • Regex - very useful, powerful and not easy feature. You can search for patterns: dates, names, words(latin or non-latin), numbers etc.

Regex Example:
if you need to change date format in a big file: DD-MM-YYYY to YYYY-MM-DD,
or 10/03/2017 to 2017/03/10

  • CTRL+H - to open replace menu
  • Find what - ([0-9]{2})-+([0-9]{2})-+([0-9]{4})
  • Replace with - \3-\2-\1
  • Regular expressions
  • Replace

Remove empty lines

If you want to remove all empty lines from text file. Then you do:

  • Main Menu -> Edit -> Line Operations
  • Remove Empty Lines or Remove Empty Lines (Containing Blank characters)

Plugin

Plugins are very nice feature. You have plenty of features added by plugins:

  • Comparison
  • NPPExport - Rich Text copy - in case that you need to copy formatted code
  • Explorer

Available plugins are visible from:

  • Main Menu -> Plugins -> Plugin Manager

You can install new plugins from the Plugin Manager or use already installed from * Main Menu -> Plugins

Compare

Comparison is fairly easy and good enough for everyday tasks. You can use plugin compare or open two files at the same time:

  • Right click at the file tab
  • Move to other view or Clone to other view

Keyboard tricks

If you want to remove all empty lines from text file. Then you do:

  • CTRL+D - duplicate line
  • CTRL+L - delete line
  • CTRL+SHIFT+U - convert text to upper case
  • CTRL+U - convert text to lower case
  • CTRL+F - find
  • F3 - find next
  • SHIFT+F3 - find previous
  • CTRL+F3 - find the current select word
  • CTRL+N - new file