天天看點

notepad++ 自定義語言格式設定(以scala為例)

notepad++具有許多語言格式,如xml、sql、java等,友善更清楚地了解代碼結構。但像scala這種新語言,notepad++還未處理,是以需要使用者設定自定義的語言格式。下面以scala為例進行說明

1. 網上找一個scala的notepad++模闆,這裡貼一個demo

<NotepadPlus>
    <UserLang name="Scala" ext="scala">
        <Settings>
            <Global caseIgnored="no" />
            <TreatAsSymbol comment="no" commentLine="yes" />
            <Prefix words1="no" words2="no" words3="no" words4="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Delimiters">"'0"'0</Keywords>
             <Keywords name="Folder+">{</Keywords>
             <Keywords name="Folder-">}</Keywords>
             <Keywords name="Operators">- ! " # % & @ | ~ + < = ></Keywords>
             <Keywords name="Comment">1/* 1/** 2*/ 2*/ 0//</Keywords>
             <Keywords name="Words1">class def extends forSome import object package trait type val var with</Keywords>
             <Keywords name="Words2">boolean byte char double float int long short false new null super this true</Keywords>
             <Keywords name="Words3">case catch do else finally for if match requires return throw try while yield</Keywords>
             <Keywords name="Words4">abstract final implicit lazy override private protected sealed</Keywords>
         </KeywordLists>
         <Styles>
             <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
             <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="004080" bgColor="FFFFFF" fontName="" fontStyle="1" />
             <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="004080" bgColor="FFFFFF" fontName="" fontStyle="1" />
             <WordsStyle name="KEYWORD1" styleID="5" fgColor="004080" bgColor="FFFFFF" fontName="" fontStyle="1" />
             <WordsStyle name="KEYWORD2" styleID="6" fgColor="004080" bgColor="FFFFFF" fontName="" fontStyle="1" />
             <WordsStyle name="KEYWORD3" styleID="7" fgColor="004080" bgColor="FFFFFF" fontName="" fontStyle="1" />
             <WordsStyle name="KEYWORD4" styleID="8" fgColor="004080" bgColor="FFFFFF" fontName="" fontStyle="1" />
             <WordsStyle name="COMMENT" styleID="1" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="2" />
             <WordsStyle name="COMMENT LINE" styleID="2" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="2" />
             <WordsStyle name="NUMBER" styleID="4" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="0" />
             <WordsStyle name="DELIMINER1" styleID="14" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" />
             <WordsStyle name="DELIMINER2" styleID="15" fgColor="800080" bgColor="FFFFFF" fontName="" fontStyle="0" />
             <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
         </Styles>
     </UserLang>
</NotepadPlus>
           

2. notepad++中找到語言-自定義語言格式-導入,選擇模闆(xml格式)點選打開(确定)

notepad++ 自定義語言格式設定(以scala為例)

3. 重新開機notepad++,點選語言就可看到自定義的語言格式

notepad++ 自定義語言格式設定(以scala為例)