Using Notepad Plus Plus as a script editor
Notepad++ is a powerful text editor based on Scintilla (which is where UniSciTE is also based from). It is available only in Windows.
Advantages:
- it can manage more than ten text files opened simultaneously
- customizable color scheme
Directions
- Notepad++ can be found in http://notepad-plus.sourceforge.net/uk/site.htm. Download and install.
- Change your External Script Editor to Notepad++ (In Unity, Edit> Preferences > General)
- Unity should now open Notepad++ whenever you double-click a script (or any text file actually).
How to add searching of Unity Documentation within Notepad++
- Download the Language Help Plugin via the Plugin Manager: Plugins > Plugin Manager > Show Plugin Manager. Then choose "Language Help" from the list, and click Install.
- Go to Plugins > Language Help > Options...
- Click Add and put these values
- Name: Unity
- Extension List: "js" (and/or "cs" if you're using C#)
- Extended help file path: http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=$word$
Now whenever you press ctrl+f1 while your cursor is on a word, it will search that word in the Unity documentation. (You can change the key binding via Settings > Shortcut Mapper)
How to enable highlighting of Unity "keywords" within Notepad++
- Open "C:\Program Files\Unity\Editor\Data\Tools\UniSciTE\unitykeywords.properties" This text file contains all the unity keywords.
- In Notepad++ go to Settings > Style Configurator...
- In the "Language:" list, select your appropriate language.
- In the "Style:" list, select Keyword (or Instruction Word).
- Add the keywords from the unitykeywords.properties file (the big block of text) into the "User-Defined Keywords" box.
- Note that the textbox may have a character limit so pasting here may not save all the Unity "keywords". Test by typing zero, that should highlight as a Unity keyword. If not, try the manual directions below.
- Save & Close. Close and open Notepad++. Voila.
How to enable highlighting of Unity "keywords" manually
- Open "C:\Program Files\Unity\Editor\Data\Tools\UniSciTE\unitykeywords.properties" This text file contains all the unity keywords.
- Open "C:\Program Files\Notepad++\stylers.xml" (If you're using a custom theme, open C:\Program Files\Notepad++\themes and open the theme XML file you are using instead.) NOTE: For Windows 7 the file is located in \users\yourusername\AppData\Roaming\Notepad++\stylers.xml
- In stylers.xml (or your theme's XML file), find: <LexerType name="javascript" desc="Javascript" ext="">
- Find the coressponding: <WordsStyle name="KEYWORD" styleID="47" fgColor="000080" bgColor="F2F4FF" fontName="" fontStyle="3" fontSize="" keywordClass="instre1"> (If there is none, add it)
- Insert all the unity keywords (found from the unitykeywords.properties you opened earlier) inside that <WordsStyle name="KEYWORD"...> tag
- Save it. Close and open Notepad++. It should highlight the Unity keywords now.
How to add Intellisense (called Auto-Completion in Notepad++) for Unityscript
This did not work in Notepad++ for me, because the Intellisense within Notepad++ does not recognize the left ("<") and the right (">") brackets in some scenarios. (about 75 scenarios): e.g. <KeyWord name="Call.<ReturnType>" func="yes"><Overload retVal=""><Param name="string methodName" /><Param name="params object[] args" /></Overload></KeyWord> The "Call.<ReturnType>" will give you an error because of the brackets surrounding ReturnType, There is not a fix programmed in for this error within Notepad++, I just went and replaced all the brackets that were giving me an error with the * symbol. It was a quick fix but the cons certainly outweigh the pros in this matter, It's suggested just to use MonoDevelop if you were looking for a free script editor in the first place.
- Turn on Auto-Completion by going to: Settings > Preferences > Backup/Auto-Completion. Check "Function parameters hint on input"
- Open "C:\Program Files\Notepad++\plugins\APIs\javascript.xml" (As of version 3.4, the Javascript and C# API are the same, therefore editing "cs.xml" will also work.)
- Depending on your version of Unity, copy and paste contents of the file specified below to anywhere inside the <AutoComplete> tags of the "javascript.xml" (or cs.xml) file. If you have trouble saving, try running Notepad++ as an administrator.:
- For JS Unity 3.3: http://unity.igorrafael.com/home/UnityAPI_JS.xml
- For JS Unity 3.4: http://dl.dropbox.com/u/25260770/Unity-Notepad%2B%2B/UnityApi_to_Npp-3.4.txt
- For C# Unity 3.5: http://unity.deitygames.com/UnityAPI_CS.txt
- For JS Unity 3.5: http://unity.deitygames.com/UnityAPI_JS.txt
- Close and open Notepad++. A function tooltip should now appear whenever you type in an open parenthesis after a Unity function.
Note: The files provided are created from the file found as "C:\Program Files\Unity\Editor\Data\Tools\UniSciTE\UnityJS.api" (or UnityCS.api), using a program made by AnomalousUnderdog (http://dl.dropbox.com/u/25260770/Unity-Notepad%2B%2B/UnityJSapi_to_Npp.py). If ever the UnityJS.api or UnityCS.api changes again (in case of a Unity update), just run the python script and post the link here for others. Python 3.x Version doesn't work, so make sure you use the Python 2.7x Version.
How to make Notepad++ jump to the correct line number from the error console
- Download the Unity External Script Editor Helper (Located at http://dl.dropbox.com/u/25260770/Unity-Notepad%2B%2B/UnityExternalScriptEditorHelper-1.0.7z)
- Extract the files and follow the instructions in the README.txt