5 cool Notepad++ tricks


Updated: January 17, 2009

Notepad++ is quite likely the best text editor for Windows. It has a huge range of features that would take quite a few articles to cover. And this exactly what I'm going to do: introduce the incredible power of this highly versatile and sophisticated text editor. No more Notepad or Wordpad for working with text files. Or scripts. Or HTML files.  So, here are (the first) five great tricks that will help you bring out the best of Notepad++.

Notepad++ intro

1. Set Language to match your code

One of the stronger features of Notepad++ is the ability to color pieces of code. This is highly useful when writing C, Matlab or HTML files, allowing you to easily visually distinguish between functions, reserved words, comments, text, and other types of symbols and expressions in your code.

Notepad++ is smart and will automatically detect your code. For example, here's a piece of a Matlab m-file:

Language

2. Bulk find & replace

If you want to replace a certain entry in your file(s), Notepad++ is your (wo)man. Not only can it instantly search through all entries in a file, it can search all open files or even all files in a directory (including sub-directories), and then, only matching certain file types.

Find 1

Find 2

3. Search for regular expressions

When it comes to finding what you want, Notepad++ is not limited to mere words. You can also use powerful regular expression to match dynamic entries. For example, the below search will find (and replace) all <img> tags in the source of HTML files, regardless of the actual image size specified:

Regular expressions

Of course, some knowledge of regular expressions is required to use this feature. Not surprisingly, these regular expressions will also serve you will if you dabble in the Linux command line with sed or awk commands.

4. Tidy HTML code

If you're writing web articles, there's a fair chance your code will include a bit of unnecessary breaks, misaligned tags and so forth. Notepad++ can Tidy your HTML code.

For example, here's a piece of unformatted text:

Unformatted

Which we wish to convert to the XHTML format:

Tidy

And Bob's your uncle:

Formatted

5. Save all open files

While this may not sound too exciting, imagine you have 100 open files - Notepad++ behaves like Firefox in this regard and opens documents in tabs - each one changed after you ran a bulk find & replace earlier. Saving them one by one can be tedious. Notepad++ saves you the hassle. You can save all open files at once.

Save all

Similarly, you can close them all at once.

Conclusion

Notepad++ is an extremely powerful tool. When used wisely, it can virtually render miracles with your text-oriented tasks. We have reviewed only a tiny, tiny selection of features. But then, you may also want to use macros or function completion, compare documents, export files to other formats, and a whole lot more. We'll talk about those in a follow-up article.

Notepad++ also has many useful plugins and it comes in a portable version.

Meanwhile, enjoy!

RSS Feed icon

del.icio.us del.icio.us stumbleupon stumble digg digg reddit reddit slashdot slashdot



Advertise!

Would you like to advertise your product/site on Dedoimedo?

Read more

Donate to Dedoimedo!

Do you want to
help me take early retirement? How about donating
some dinero to
Dedoimedo?

Read more

Donate