Skip to content

Instantly share code, notes, and snippets.

@Thermionix
Last active October 1, 2024 15:04
Show Gist options
  • Save Thermionix/9ff4a362f2bdc026c0ec to your computer and use it in GitHub Desktop.
Save Thermionix/9ff4a362f2bdc026c0ec to your computer and use it in GitHub Desktop.
Groovy user defined language for notepad++
<NotepadPlus>
<UserLang name="Groovy" ext="groovy" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">03/* 04*/ 00// 01 02</Keywords>
<Keywords name="Keywords1">abstract break case catch continue default do else extends final finally for if implements instanceof native new private protected public return static switch synchronized throw throws transient try volatile while strictfp package import false null super this true</Keywords>
<Keywords name="Keywords2">as assert def mixin property test using in it</Keywords>
<Keywords name="Keywords3">boolean byte char class double float int interface long short void</Keywords>
<Keywords name="Keywords4">abs any append asList asWritable call collect compareTo count div dump each eachByte eachFile eachLine every find findAll flatten getAt getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter newReader newWriter next plus pop power previous print println push putAt read readBytes readLines reverse reverseEach round size sort splitEachLine step subMap times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader withStream withWriter withWriterAppend write writeLine</Keywords>
<Keywords name="Delimiters">00&quot; 01 02&quot; 03&apos; 04 05&apos;</Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" nesting="0" />
<WordsStyle name="COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" nesting="0" />
<WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" nesting="0" />
<WordsStyle name="NUMBERS" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="006699" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" nesting="0" />
<WordsStyle name="KEYWORDS3" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="804000" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS2" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
</Styles>
</UserLang>
</NotepadPlus>
@dmitrykolesnikovich
Copy link

Thanks!

@dartkerth
Copy link

Thanks!

@dinumathai
Copy link

Thanks

@hungndv
Copy link

hungndv commented Apr 21, 2018

Thanks!

@generic101
Copy link

Merci !!!

@rojagit
Copy link

rojagit commented Apr 30, 2018

Had an issue after I installed the Dracula theme - how can I fix it ?

@pjdarton
Copy link

pjdarton commented Jun 6, 2018

This gets very confused by multi-line strings, e.g.

def foo = '''\
    Hello World!
    How y'all doing?'''.stripIndent()

Really needs to define """...""" and '''...''' as delimiters 1 and 2, and then define "..." and '...' as delimiters 3 and 4.

@tezvi
Copy link

tezvi commented Aug 4, 2018

@pjdarton thx for mentioning.
Also to other gisters you'll have to apply custom color (grey) for delimiters 3 and 4. Otherwise it might confuse you as default black is used.

Replace existing Keywords element:

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

Add new elements:

<WordsStyle name="DELIMITERS3" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS4" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />

@CollinChaffin
Copy link

CollinChaffin commented Oct 18, 2018

EDIT: It wasn't clear but I just tested to confirm what you were suggesting actually is the final line edit and not that it be changed. Thanks!

@pdemanget
Copy link

Usage:

  • click on "raw" then save the file (Ctrl-S)
  • Open Notepad++ and open the "Define Your Language" tool in the Language menu
  • Click "Import" and select the XML file

@ronhks
Copy link

ronhks commented Apr 2, 2020

thanks!

@lospejos
Copy link

A couple of notes:

  1. Probably the shebang string requires some separate color (green, teal or some kind of)
  2. After Importing XML file restart is required for changes to be applied. At least on my NPP 7.8.5

@abashind
Copy link

Thanks a million!

@Liad-n
Copy link

Liad-n commented Aug 4, 2020

Thanks!

@varkychen
Copy link

Thanks

@bitNcode
Copy link

Thank you. However, after changing the Language preference to Groovy, the editor highlighted the script with the white background, which became very difficult to read.
I reverted back the language preference of the editor to Java.

@sparrowt
Copy link

sparrowt commented Oct 27, 2021

https://gist.github.com/sparrowt/ced1eac10318e4b9deeedbcb12d65d36 is a modified version of this with the following changes:

  • for use with a dark theme (mine is based on 'Mono Industrial')
  • incorporates the multi-line string improvements mentioned in comments above

@TheXSVV
Copy link

TheXSVV commented Jun 27, 2023

Thanks!

@CimermanDenis
Copy link

Thanks!

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