Supporting Techniques - Making Configuration Files Legible in Notepad++

Updated 12 September 2016

Notepad++ is one of the best text editors around and the one I always use for editing configuration files.

However out of the box it understandably does not include the Bentley CFG file language so all text is the default black.

I recommend setting the Notepad++ Setting menu > Preferences > Tab Settings > Tab Size to 8 for best presentation of tab spacing.

To transform your configuration files into this feast of colour, simply setting all the commented out content to green makes an immediate difference to legibility:

The eagle eyed may spot that that the screen grab above is from msconfig.cfg; which presents another opportunity to say that this file is look but don't touch. Never edit this file!

Try one or both of these language files:

White Background

Yellow Background This version has a parchment background colour that I find more restful on my eyes than white.
Set the Notepad++ default background RGB to 250:228:146 in Settings > Style Configurator > Global Styles > Default Styles for maximum restfulness.

Use the Language menu > Define your language... dialog (which can be docked) to import one or both of the linked xml files, it should appear on the user Language pop-down as 'Bentley CFG 2'.
Once Notepad++ is restarted it will then appear at the foot of the languages menu.

Consult the Notepad++ documentation for further information on languages if needed.

The colour coding provided is a pretty consistent cue to the various types of variables and operators populating these files. The formatting is as follows:

  • Green/Courier New for comments
    White on Orange for Configuration Level statements

    Note that Comments can be folded by clicking the +/- icons to the left.

  • Red for 'expand when used' variables $( )
  • White on Blue background for 'expand current value' variables ${ }
  • Blue for operators
  • Pink for %if statements

    Folding is applied to %if statements.
  • White on Purple for any company specific variables (listed in Keywords List 5th Group. It is easy to add your own if needed.
  • Black Italic on Red for variables listed as removed in later versions. This indication is advisory, any decisions to remove variables must be made in conjunction with the appropriate documentation or advice.

Export the coloured text:

The NppExport plug-in enables file contents to be exported with all colours to RTF:

This is helpful when documenting your configurations:

(If you use the yellow background version of the xml, the pasted RTF will be highlighted in yellow, but that's easy to change after pasting.)

Keyword lists

Much of the fomatting above is provided by keyword lists. These lists will be updated periodically but are not comprehensive and do not cover all Bentley products based on the MicroStation platform. They are not linked to any Bentley products so there will inevitably be omissions from existing and future variables as products develop.

The keyword lists provide additional benefits:

If a listed variable is mistyped it will not receive the expected formatting, as shown by the omission of an '_' character in the list below:

The Notepad++ pop-up spelling lists are pre-populated by the keywords which is helpful for spell checking.

  • I cannot download the attachment, could you please upload them again

  • I just downloaded NotePad++ v6.7 and tried to import either of the two XML files posted here and it says "Failed to Load".  Are the XML files outdated?  Or is there something else besides simply clicking the "Import" button and mapping to the xml file that I need to do.

    Thanks,

    -Tom

  • With XML files being used in so many places, this is also an awesome editor for that - provided you load the XML Tools add-in. As an InRoads user and CADD Manager, it is as essential as any other software I have.

    And for CFG files, add cfg, ucf and pcf to the extensions under the bash language and it will use a Unix shell syntax highlighting. It also allows you to copy a file with syntax highlighting as html or rtf where you can paste it into Word for documentation and presentations.

    I had been an Emacs geek since IGDS days when it was the one editor that ran on VMS, Unix and DOS - so I did not have to learn three editors. I still have a copy of WinEmacs, but since finding Notepad++ I have only fired it up for grins and giggles!

  • NotePad++ is, I believe, FreeWare!  

    Another text editor that can show context-sensitive colouring is TextPad (http://www.textpad.com/); they also have WildEdit, which is used for making batch edits to multiple text files.

    Regards, Jon Summers