This morning a colleague mentioned that it would be nice to have syntax highlighting for NetScaler configuration files in Notepad++, so what better way to have one, then to make one!
Below is my initial draft of a user-defined language for NetScaler; to use it in Notepad++ just save the following content as an .xml file:
<NotepadPlus> <UserLangname="NetScaler"ext="conf"udlVersion="2.0"> <Settings> <GlobalcaseIgnored="yes"allowFoldOfComments="no"forceLineCommentsAtBOL="no"foldCompact="no"/> <PrefixKeywords1="no"Keywords2="no"Keywords3="no"Keywords4="no"Keywords5="yes"Keywords6="no"Keywords7="no"Keywords8="no"/> </Settings> <KeywordLists> <Keywordsname="Comments"id="0">00! 00remark 01 02((EOF)) 03 04</Keywords> <Keywordsname="Numbers, additional"id="1">:</Keywords> <Keywordsname="Numbers, prefixes"id="2"></Keywords> <Keywordsname="Numbers, extras with prefixes"id="3"></Keywords> <Keywordsname="Numbers, suffixes"id="4"></Keywords> <Keywordsname="Operators1"id="5">. /</Keywords> <Keywordsname="Operators2"id="6"></Keywords> <Keywordsname="Folders in code1, open"id="7"></Keywords> <Keywordsname="Folders in code1, middle"id="8"></Keywords> <Keywordsname="Folders in code1, close"id="9"></Keywords> <Keywordsname="Folders in code2, open"id="10"></Keywords> <Keywordsname="Folders in code2, middle"id="11"></Keywords> <Keywordsname="Folders in code2, close"id="12"></Keywords> <Keywordsname="Folders in comment, open"id="13">{</Keywords> <Keywordsname="Folders in comment, middle"id="14"></Keywords> <Keywordsname="Folders in comment, close"id="15">}</Keywords> <Keywordsname="Keywords1"id="16">add bind set remove rm show sh unbind</Keywords> <Keywordsname="Keywords2"id="17">aaa route responder rewrite vpn interface ns </Keywords> <Keywordsname="Keywords3"id="18">ip vserver policy action</Keywords> <Keywordsname="Delimiters"id="24">00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords> </KeywordLists> <Styles> <WordsStylename="DEFAULT"styleID="0"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="COMMENTS"styleID="1"fgColor="008000"bgColor="FFFF80"fontName=""fontStyle="0"nesting="117702655"/> <WordsStylename="LINE COMMENTS"styleID="2"fgColor="008000"bgColor="F2F2F2"fontName=""fontStyle="0"nesting="117702655"/> <WordsStylename="NUMBERS"styleID="3"fgColor="C60000"bgColor="FFFFFF"fontName=""fontStyle="1"nesting="0"/> <WordsStylename="KEYWORDS1"styleID="4"fgColor="AC8202"bgColor="FFFFFF"fontName=""fontStyle="1"nesting="0"/> <WordsStylename="KEYWORDS2"styleID="5"fgColor="0000C1"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="KEYWORDS3"styleID="6"fgColor="FF0000"bgColor="FFFFFF"fontName=""fontStyle="1"nesting="0"/> <WordsStylename="OPERATORS"styleID="12"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="FOLDER IN CODE1"styleID="13"fgColor="804000"bgColor="FFFFFF"fontName=""fontStyle="1"nesting="0"/> <WordsStylename="FOLDER IN CODE2"styleID="14"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="FOLDER IN COMMENT"styleID="15"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="DELIMITERS1"styleID="16"fgColor="FF80C0"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="DELIMITERS2"styleID="17"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="DELIMITERS3"styleID="18"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="DELIMITERS4"styleID="19"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="DELIMITERS5"styleID="20"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="DELIMITERS6"styleID="21"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="DELIMITERS7"styleID="22"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> <WordsStylename="DELIMITERS8"styleID="23"fgColor="000000"bgColor="FFFFFF"fontName=""fontStyle="0"nesting="0"/> </Styles> </UserLang> </NotepadPlus>
Then open NPP and click ‘Language > Define your language…’:
Then click ‘Import’ to load it up:
Once loaded you should see most NetScaler syntax highlighted accordingly:
Enjoy!
Thank you for this! It would be great if there was one for Sublime Text too.
Is there another link for the syntax highlighting file? It doesn’t seem to be in the Google Drive anymore. Thanks Kenny!
Hey Ray; thanks for the reply. I didn’t realize the link had expired, and so I just edited the original post and put the full XML in the body; enjoy!