Jun 12, 2011

5 cool Notepad++ tricks

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++.

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:



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.

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 tags in the source of HTML files, regardless of the actual image size specified:

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:






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.

No comments:

Post a Comment

Visual Studio Keyboard Shortcuts

Playing with keyboard shortcuts is very interesting and reduce the headache of using the mouse again and again while programming with visu...