NXC Syntax Highlighting in Notepad++

Once you’re done with Spiller’s post on compiling NXC code in Notepad++, you may wish to improve the look of things a bit.

NOTE: Due to Notepad++ limitations, we’re going to have to sacrifice the C language, and NXC shalt be born from its ashes. (Don’t worry: you can always use C++ as a substitute. :))

Let us begin.

Adding the .nxc File Extension

  1. Open up Settings->Style Configurator...
  2. Select C under Language :
  3. Under User ext. :, add nxc

This straightforward, humble action should bring life to your source code.

Adding Keywords

In the same Style Configurator dialog:

  1. Under Style :, select INSTRUCTION WORD
  2. Under User-defined keywords, copy and paste the following:
    __FLTRETVAL__ __RETURN__ __RETURNF__ __RETURNS__ __RETURNU__ __RETVAL__ __STRRETVAL__ __STRBUFFER__ __STRTMPBUFFER__ __TMPBYTE__ __TMPFLOAT__ __TMPLONG__ __TMPULONG__ __TMPWORD__ asm false mutex priority repeat start stop sub true until
  3. Under Style :, select TYPE WORD
  4. Under User-defined keywords, copy and paste the following:
    bool byte string inline safecall task

Adding Function Auto-Completion

  1. Open up Settings->Preferences...
  2. Click on the Backup/Auto-Completion tab
  3. Under Auto-Completion, check the Enable auto-completion on each input and Function parameters hint on input checkboxes
  4. Select Function completion
  5. You may also wish to change it to “From 3 th character”, or something like that.

Customizing Function Auto-Completion for NXC

UPDATE: I haven’t tried it yet, but bungeshea has made a new version that uses features introduced in Notepad++ 6.2.

This part is not for the faint-hearted. Venture on if you dare. (Actually, it’s not that complicated.)

  1. Download the NXC API to Notepad++ XML Converter binaries here. (Or compile them from source, if you wish.)
  2. Drag the %ProgramFiles%\BricxCC\Default\nxc_api.txt to NXC API to Notepad++ XML.exe.
  3. Rename the newly generated nxc.xml file to c.xml.
  4. Move c.xml to %ProgramFiles%\Notepad++\plugins\APIs\.

That’s it!

Plugins

NppAutoIndent

This gives you a “smart indentation” feature. I find it pretty useful.

  1. Download the NppAutoIndent plugin:
    1. Open up Plugins->Plugin Manager->Show Plugin Manager
    2. Under the Available tab, check the NppAutoIndent checkbox
    3. Click Install
  2. Enable Plugins->NppAutoIndent->Smart Indent

~ by muntoo on July 13, 2011.

Leave a comment