How to setup EditPlus for compiling Powtils programs

Introduction

EditPlus can act as a lightweight web development IDE with line number error jumping and syntax hilighting.

This article can be used as an example for how to setup other editors, such as ConTEXT, Lazarus, pspad, Syn, Notepad++, textpad, MSEIDE tools menu, etc.

In some editors, such as Lazarus tools menu, you may need to use

  cmd /k fpc
or the full path to command may be required...
  c:\winnt\system32\command.com /k fpc
or
  c:\winnt\system32\cmd.exe /k fpc 
Note that on Windows 98 there is most likely no cmd.exe.

Any editor with a tools menu and "tools menu macros" will work, and it just requires finding the correct commands.

What EditPlus can do

The text editor can capture output from the freepascal compiler and place it into a status window. The editor also can jump to the line number that an error is on, since editplus automatically finds out what errors your line numbers are on by parsing the compiler input. For example, if you have a syntax error on line 6, editplus can jump to that line if you click on the syntax error in the status window which was captured by the compiler.

Setting up FPC config file

FPC.CFG is a simple and easy file to set up so that you can set up standard search paths for the units you wish to place in the uses clause. Although setting up an fpc config file for your project may seem like more work, it is actually the same as opening a lazarus or delphi dialog window and setting up your search paths there. The only difference is that instead of entering search paths into a GUI dialog's edit widget, you simply type in the search path with an -Fu prefix. For include files use -Fi.

The amount of time it takes to type in -Fi and -Fu along with your search path is really no longer than it takes to open up a GUI dialog window. Name your FPC config file FPC.CFG and save it in the same directory that your project file is located. Since you are already in EditPlus, all you have to do is make a new text file like so:

#-------------fpc.cfg begin--------#

#INCLUDE c:\fpc\2.2.0\bin\i386-win32\fpc.cfg

-Fu your/search/paths

# smart link and strip, if you like
-CX
-XX
-Xs

#-------------fpc.cfg end----------#

Using Program Templates

Many editors allow you to make a template, and save it for later reuse.

Make a simple program template like so:

  program abc;

  uses pwumain;

  begin

  end.
Make another template for units, and save it:
  unit xyz;

  interface
  uses pwumain;

  implementation

  end.

Once you set up EditPlus it is easy

Although it takes about 5-10 minutes to setup and editor, you can really get used to your editor as a lightweight IDE. You can simply hit CTRL-1 or F9 (if you set it up) and your application will be compiled just like in an IDE. A lot of people use a text editor and just compile at the command line - but editplus can allow you to integrate your compiling so you can easily navigate error messages that the compiler spits out.

As lazy Pascal/Delphi programmers, some of us have gotten so used to Rapid IDE's like Delphi and Lazarus that it makes me sad. Some of us are too lazy to setup editplus and other editors for web development. True, EditPlus doesn't have all the features of a full featured IDE - but some people don't even know about EditPlus's feature where you can trap compiler output and click on error messages just like in a real IDE.

You can even modify EditPlus's way of trapping the output with numerous regex options.

Note: make sure you setup $(FileDir) macro and $(FilePath) macro in the dialog box like shown in the picture at the top of this article. If you do not setup the "Initial Directory" as shown in the picture, your local FPC.CFG file will not be found!

This article was composed by the PSP Development Team member L505.
Do you have an article? We can publish it here with your name, company, web address. Tell us at PasForum or on the mailing lists.