Home > computers > Add Reg­Exp and Com­ment­Doc High­light­ing for JS to Programmer’s Notepad

Add Reg­Exp and Com­ment­Doc High­light­ing for JS to Programmer’s Notepad

July 13th, 2011 Leave a comment

    For a cou­ple of days now I’ve been using Programmer’s Notepad instead of Notepad++. It’s smaller, it’s faster, and its mem­ory foot­print is roughly one third of Notepad++. Yes, there are fewer plug-ins avail­able and it’s not get­ting updated as often as its more famous com­peti­tor but guess what – it has every­thing I need. Today I tried to cre­ate a scheme for JavaScript syn­tax high­light­ing that appeals to me. It was very easy and there are only a few very small bugs to iron out.

    Any­way, I wasn’t able to style Com­ment­Doc key­words and reg­u­lar expres­sions. As usual, Google came to the res­cue. After doing some research I found that I had to man­u­ally edit the cpp.scheme file in the schemes direc­tory of Programmer’s Notepad. Look for the fol­low­ing part and add the high­lighted lines to your file:

    <language base="cppbase" name="javascript" title="JavaScript" folding="true" foldcomments="true" foldelse="true" foldcompact="true">
      <comments line="//" streamStart="/*" streamEnd="*/" blockStart="/**" blockLine=" *" blockEnd=" */" />
      <use-keywords>
        <keyword key="0" name="Keywords" class="javascript"/>
        <keyword key="1" name="Keywords 2" class="jsunsure"/>
        <keyword key="2" name="CommentDoc Keywords" class="commentdockw"/>
      </use-keywords>
      <use-styles>
        <style name="Doc Comments" key="3" class="commentdoc"/>
        <style name="Keywords 2" key="16" fore="b00040"/>
        <style name="Comment Doc Keyword" key="17" fore="3060a0"/>
        <style name="Unknown Comment Doc Keyword" key="18" fore="804020"/>
        <style name="RegEx" key="14" fore="3f7f3f" back="e0f0ff" eolfilled="true"/>
      </use-styles>
    </language>
    

    Now we only have to cre­ate the com­ment­dockkw class we added in the code above (sim­ply add the high­lighted lines to your cpp.scheme at the appro­pri­ate position):

      ...
      <keyword-class name="jsunsure">
        undefined
      </keyword-class>
      <keyword-class name="commentdockw">
        <!-- JsDoc tags -->
        augments author borrows class constant constructor constructs default
        deprecated description event example exports field fileOverview function
        ignore inner lends link memberOf name namespace param private property
        public requires returns see since static throws type version
      </keyword-class>
    </keyword-classes>
    

    That’s it. Save the file and start Programmer’s Notepad. Now you’re able to apply cus­tom styling to reg­u­lar expres­sions and com­ment doc key­words. On the Key­words tab you can edit the key­words we defined above.

    Categories: computers Tags: ,
    1. July 28th, 2011 at 10:18 | #1

      Hell yea, i want put on paper some­thing like this but didnt have date, may i repost this reckon up Reg­Exp and Com­ment­Doc High­light­ing for JS to Programmer’s Notepad | Brain Assassin

    2. bstecklu
      August 15th, 2011 at 12:29 | #2

      Looks like apple changed its page again. The script hangs while retriev­ing the infor­ma­tion with CPU load reach­ing 100%.

    1. No trackbacks yet.