Skip to content

Instantly share code, notes, and snippets.

@blinksmith
Last active April 18, 2024 08:53
Show Gist options
  • Star 40 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save blinksmith/99e5234ea601af8ba8bfab35c8fbebef to your computer and use it in GitHub Desktop.
Save blinksmith/99e5234ea601af8ba8bfab35c8fbebef to your computer and use it in GitHub Desktop.
Notepad++ Syntax Highlight for Go
<NotepadPlus>
<UserLang name="Golang" ext="go" udlVersion="2.1">
<!--
NPP Syntax Highlight for Go
using most used color in NPP for Golang.
Author: blinksmith Version: 0.1.3
Last tested in Notepad++ v7.5.9
Quick start :
Method 1
- Download golang.udl.xml and then open notepad++
- Go to Toolbar Menu -> Language -> "Define your language..." -> Import.
- Import golang.udl.xml and restart NPP.
Method 2 (Recommended Version)
- Go to https://stackoverflow.com/a/36329825/5882350 I will try to explain it in there.
-->
<Settings>
<Global caseIgnored="no" decimalSeparator="2" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00// 01 02 03/* 04*/</Keywords>
<Keywords name="Numbers, prefix1">A B C D E F a b c d e f X x O o</Keywords>
<Keywords name="Numbers, range">A B C D E F a b c d e f X x O o</Keywords>
<Keywords name="Operators1">&amp;^= := &gt;&gt;= &lt;&lt;= &gt;= &lt;= &lt;- -&gt; &lt;&lt; &gt;&gt; ... %= &amp;= += &amp;&amp; == != -= -= |= ++ || *= ^= /= %v %k %s %t | ! . - </Keywords>
<Keywords name="Operators2">&amp; % ^ + / *</Keywords>
<Keywords name="Folders in code1, open">{</Keywords>
<Keywords name="Folders in code1, close">}</Keywords>
<Keywords name="Keywords1">package import type func var const</Keywords>
<Keywords name="Keywords2">break case chan continue default defer else func() fallthrough for go goto if interface map range return select switch true false</Keywords>
<Keywords name="Keywords3">struct append bool byte cap close closed copy imag len make new panic print println range real recover select string utf8 nil</Keywords>
<Keywords name="Keywords4">int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 uintptr float32 float64 complex complex128 complex64 iota</Keywords>
<Keywords name="Delimiters">00[ 01 02] 03&quot; 04 05&quot; 06&apos; 07 08&apos; 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
</KeywordLists>
<Styles>
<!--
000000 black for default color.
AA0000 red for important thing.
800000 dark red the most important.
0000FF blue for function.
000080 dark blue for operator.
008000 green for comment line, we use 008040.
FF8000 orange for number.
8000FF purple for double quoted. #FIXME black
-->
<WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="LINE COMMENTS" fgColor="008040" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="NUMBERS" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS3" fgColor="AA0000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="FOLDER IN CODE1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS2" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS3" fgColor="AA0000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
</Styles>
</UserLang>
</NotepadPlus>
@Oneiros90
Copy link

Oneiros90 commented May 17, 2018

Thank you for this.
Did you forgot to escape string delimeters?

<Keywords name="Delimiters">00[ 01 02] 03&quot; 04\ 05&quot; 06&apos; 07\ 08&apos; 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>

@RicheleZZ
Copy link

Ok, really good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment