DevHeart Web Development Write code faster, with less effort

Write code faster, with less effort

Write code faster, with less effort

Speed up your coding using text-expanding, auto-completion and macros.

This article describes a number of time saving features available in modern text-editors. I have chosen to describe how use these features in Notepad++ because its free, lightweight and packed with features.

Download Notepad++

 

Text-expanding

Text-expanding allows you to define a set of tags that are replaced with a template consisting of text and tab stops ($) whenever you press a selected key (TAB by default).

Enable text-expanding in NPP by installing QuickText (plugin). It should be available via the plugin manager (click the checkbox next to its name and then the “install” button), if not then download it from SourceForge and manually install it. Once installed you can configure it via “Plugins” / “QuickText”.

QuickText is lightweight, easy to use, and comes with a pre-defined set of tags and substitution templates for the most common programming languages

QuickText

Example tags and substitutions

if+TAB

Text-expand: if (PHP)

<if+TAB

Text-expand: if, in HTML (PHP)

foreach+TAB

Text-expand: foreach (PHP)

Text-expanding allows you to focus on code logic, not on formatting, braces, creating new lines etc.

Auto-completion

Enable in “Settings” / “Preferences” / “Backup/Auto-completion”.

Auto-completion (PHP)

You can tell NPP to autocomplete functions or variable names while typing or bind a shortcut key.

Macros

NPP allows you to save and run custom macros (scripts), which is a sequence of recorded key strokes, and bind shortcut keys to execute them.

Creating macros in Notepad++

Creating macros in Notepad++

Example macro
One of my most used macro is very simple and consists of 3 actions. It allows you to end a line quickly wherever your current position is in the line.

  1. END
  2. ;
  3. ENTER

Example of macro in Notepad++

Using the macro is way faster than doing it manually each time. The amount of time saved grows with the complexity of the macro.

More time-saving features

In addition to the ones mentioned earlier, I also have the following features enabled.

Function parameters hints

Enable in “Settings” / “Preferences” / “Backup/Auto-completion”.

Function parameters hints (PHP)

If you like me often forget the order of which some function accept parameters, you open your browser, visit the function reference and take a look. With this feature you don’t have to and in the long run that saves a lot of time.

Autoclose braces ({[ and XHTML/XML <tags>

Enable in “Text FX” / “Text FX Settings”.

Autoclose braces and tags

Autoclosing braces and XHTML tags saves some time and also reduces the chance of having unmatched close/opening tags.

Consider the following example (PHP):

$var = trim(substr(str_replace('a', 'b', $array[0

From there it’s really easy to mix up braces and forget to close all of them correctly.

-

If you sum up all the seconds (or even 10ths of a second) that you save using these features over a year, you’ll find that you have saved an immense amount of time.

 
 
 

Comments: 3

Feel free to share your thoughts on this article.

  • Koen De Groote

    QuickText isn’t showing up in the manager for me.

     
     
     
  • Svenn

    I have been looking so long for this, very useful, thx!

     
     
     
  • Leave a Reply
     
    Your Name
     
     
     
     
     
 
© 2014 DevHeart and the authors.
Powered by WordPress | Created by Arcsin