Using the ConTEXT text editor, update

(Update of an article originally published April 6th, 2008)
A good text editor is one of the most useful tools you can install on your computer, particularly if you do a lot of technical work. If you are using a primitive utility like NotePad, you owe it to yourself to move up. The good news is that you can get a high-power editor for free — ConTEXT is available at: http://www.contexteditor.org/ This article describes some improvements you can make after installing the program.

Add syntax highlighting for Field Precision programs

One of the main features of ConTEXT is flexible syntax highlighting. You can obtain highlighter files for specific file types (perl, php, html, …) on the ConTEXT website. We have prepared custom syntax highlighting files for Field Precision program input scripts. Syntax highlighting (Fig. 1) does more than improve the appearance. You can immediately spot spelling mistakes and invalid commands. Here’s how to add the feature:

1. Download this file: FieldPrecisionSyntaxHighlighters.zip.

2. Unzip it in the directory

\Program Files (x86)\context\highlighters

to create the following files

fieldp_ain.chl (Aether)
fieldp_cdf.chl (MagWinder)
fieldp_dst.chl (GenDist)
fieldp_ein.chl (EStat and EMP)
fieldp_gin.chl (Magnum and GamBet)
fieldp_hin.chl (HiPhi)
fieldp_min.chl (Mesh and MetaMesh)
fieldp_nin.chl (Nelson)
fieldp_oin.chl (OmniTrak)
fieldp_pin.chl (PerMag and Pulse)
fieldp_rin.chl (RFE2 and RFE3)
fieldp_scr.chl (Analysis scripts)
fieldp_tin.chl (Trak and TDiff)
fieldp_win.chl (WaveSim and HeatWave)

3. Highlighting will automatically be applied to files with the listed suffixes the next time you run ConTEXT. You can edit the chl files if you want to change colors or other properties.

Syntax highlighting

Figure 1. Editing a GenDist input script with syntax highlighting.

 

Add spell checking

One of the few things that ConTEXT lacks is spell checking. Here’s how to integrate the Aspell program.

1) For a Windows installation, go to http://aspell.net/win32/.

2) Download the Full installer to your desktop and also download a dictionary for the language of your choice. (Note: both installers must be run on the C: disk.)

3) Run the program installer (Aspell-0-50-3-3-Setup.exe) first and then run the dictionary installer (e.g., Aspell-en-0.50-2-3.exe).

4) Run ConTEXT and click on Options/Environmental options. Activate the Execute keys tab then click on Add. Type txt in the dialog box and click OK.

5) Pick an activation key like F9. Browse for or type in the program name

C:\Program Files\Aspell\bin\aspell.exe

in the Execute box. Enter

check --dont-backup %n

in the Parameters box.

6) Go to the General tab in Environmental options. Check the boxes Detect file changes by other applications and Automatically update changed files.

7) You’re ready to go. The next time you are editing a .txt file, press F9 to activate spell checking. Aspell opens in a terminal window (Fig. 2). It runs through the file contents, pointing out possible misspellings. In this case, pick one of the options in the bottom panel. When you exit, the file is updated and automatically reloaded into ConTEXT.

8) As set up, the F9 command operates only on files with the suffix txt. You can add other file suffixes like html or tex.

9) For information on Aspell’s other features, see the manual at

http://aspell.net/man-html/index.html
Aspell window.

Figure 2. Aspell window.

Footnotes

[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.

Comments are closed.