Notepad++下GO配置文件高亮显示和代码自动补全

首先是高亮,新建个xml文件  导入自定义语言格式

 

<NotepadPlus>
<UserLang name="GO" ext="go">
<Settings>
<Global caseIgnored="no" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">&quot;`0&quot;`</Keywords>
<Keywords name="Folder+"></Keywords>
<Keywords name="Folder-"></Keywords>
<Keywords name="Operators">( ) [ ] { } ... . , _ &amp; ^ % &gt; &lt; ! = + - * | :</Keywords>
<Keywords name="Comment"> 1/* 2*/ 0//</Keywords>
<Keywords name="Words1">append bool break byte cap case chan close complex complex128 complex64 const continue copy default defer else fallthrough false float32 float64 for func go goto if iota imag import int int16 int32 int64 int8 interface len make map new nil package panic print println range real recover return select string struct switch true type uint uint16 uint32 uint64 uint8 uintptr var</Keywords>
<Keywords name="Words2"></Keywords>
<Keywords name="Words3"></Keywords>
<Keywords name="Words4"></Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="FOLDEROPEN" styleID="12" fgColor="FFFF00" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="0B243B" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="KEYWORD1" styleID="5" fgColor="AA0000" bgColor="FFFFFF" fontName="" fontStyle="1" />
<WordsStyle name="KEYWORD2" styleID="6" fgColor="AA0000" bgColor="FFFFFF" fontName="" fontStyle="1" />
<WordsStyle name="KEYWORD3" styleID="7" fgColor="AA0000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="KEYWORD4" styleID="8" fgColor="A00000" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="COMMENT" styleID="1" fgColor="AAAAAA" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="COMMENT LINE" styleID="2" fgColor="AAAAAA" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="NUMBER" styleID="4" fgColor="A52A2A" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="OPERATOR" styleID="10" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="1" />
<WordsStyle name="DELIMINER1" styleID="14" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="DELIMINER2" styleID="15" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
<WordsStyle name="DELIMINER3" styleID="16" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
</Styles>
</UserLang>
</NotepadPlus>

 

 

 

 

代码补全需要新建一个 go.xml放到主程序目录的 \plugins\APIs里,内容如下:

 
 

<?xml version="1.0" encoding="Windows-1252" ?>
<NotepadPlus>
<AutoComplete>
<KeyWord name="append"/>
<KeyWord name="bool" />
<KeyWord name="break" />
<KeyWord name="byte" />
<KeyWord name="cap" />
<KeyWord name="case" />
<KeyWord name="chan" />
<KeyWord name="close" />
<KeyWord name="complex" />
<KeyWord name="complex128" />
<KeyWord name="complex64" />
<KeyWord name="const" />
<KeyWord name="continue" />
<KeyWord name="copy" />
<KeyWord name="default" />
<KeyWord name="defer" />
<KeyWord name="else" />
<KeyWord name="fallthrough" />
<KeyWord name="false" />
<KeyWord name="float32" />
<KeyWord name="float64" />
<KeyWord name="for" />
<KeyWord name="func" />
<KeyWord name="go" />
<KeyWord name="goto" />
<KeyWord name="if" />
<KeyWord name="iota" />
<KeyWord name="imag" />
<KeyWord name="import" />
<KeyWord name="int" />
<KeyWord name="int16" />
<KeyWord name="int32" />
<KeyWord name="int64" />
<KeyWord name="int8" />
<KeyWord name="interface" />
<KeyWord name="len" />
<KeyWord name="make" />
<KeyWord name="map" />
<KeyWord name="new" />
<KeyWord name="nil" />
<KeyWord name="package" />
<KeyWord name="panic" />
<KeyWord name="print" />
<KeyWord name="println" />
<KeyWord name="range" />
<KeyWord name="real" />
<KeyWord name="recover" />
<KeyWord name="return" />
<KeyWord name="select" />
<KeyWord name="string" />
<KeyWord name="struct" />
<KeyWord name="switch" />
<KeyWord name="true" />
<KeyWord name="type" />
<KeyWord name="uint" />
<KeyWord name="uint16" />
<KeyWord name="uint32" />
<KeyWord name="uint64" />
<KeyWord name="uint8" />
<KeyWord name="uintptr" />
<KeyWord name="var" />
</AutoComplete>
</NotepadPlus>

 

posted @ 2022-01-21 16:21  wsh3166Sir  阅读(229)  评论(0编辑  收藏  举报