{"id":666,"date":"2013-02-26T03:59:49","date_gmt":"2013-02-26T02:59:49","guid":{"rendered":"http:\/\/www.edy.es\/dev\/?page_id=666"},"modified":"2013-07-06T13:13:03","modified_gmt":"2013-07-06T11:13:03","slug":"using-notepad-plus-plus-as-external-editor-in-unity-3d","status":"publish","type":"page","link":"https:\/\/www.edy.es\/dev\/docs\/using-notepad-plus-plus-as-external-editor-in-unity-3d\/","title":{"rendered":"Using Notepad++ as external editor in Unity 3D"},"content":{"rendered":"<p>Summary:<\/p>\n<ul>\n<li><a href=\"http:\/\/notepad-plus-plus.org\/\">Notepad++<\/a>\u00a0(version 6.3 at the time of writing this)<\/li>\n<li><a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/02\/UnitEd-Redirector.zip\">UnitEd Redirector<\/a><\/li>\n<li><a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/02\/unitykeywords41.txt\">Keywords file for Unity 4<\/a>\u00a0(for\u00a0<em>Add the keywords to Notepad++<\/em> below)<\/li>\n<li><a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/02\/UnityToNpp41.txt\">Auto-completion info for Unity 4<\/a>\u00a0\u00a0(for\u00a0<em>Enable auto-completion and hints for function parameters<\/em> below, file is already parsed with the Python script)<\/li>\n<li><a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/02\/EdyNppFilesForUnity41.zip\">Edy.xml, cs.xml and javascript.xml<\/a> files for Notepad++:<br \/>\n&#8211; Edy.xml is my own theme which includes the keywords for CS and JS. Move to the <em>themes<\/em> folder.<br \/>\n&#8211; cs.xml and javascript.xml are the auto-completion and function hint information files. Move to <em>plugins\\APIs<\/em> overwriting the existing ones.<\/li>\n<\/ul>\n<h3>Configuring Unity 3D for using Notepad++<\/h3>\n<p>If you choose Notepad++ as external editor in Unity&#8217;s Preferences, clicking on an error message will open the file but will NOT move the focus to the offending line.<\/p>\n<ol>\n<li>Download <a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/02\/UnitEd-Redirector.zip\">UnitEd Redirector<\/a> (original by Yggy King, updated by me, source included) and unzip it to a folder of your choice.<\/li>\n<li>Choose the\u00a0<em>monodevelop.exe<\/em> file of the redirector as the external editor in Unity3D.<\/li>\n<li><a title=\"How to set an environment variable. Opens in a new window\/tab.\" href=\"http:\/\/www.itechtalk.com\/thread3595.html\" target=\"_blank\">Set the environment variable<\/a> UNITYEDITOR in Windows as follows:\n<pre>UNITYEDITOR=&lt;full-path-to-notepad++&gt;\\notepad++.exe -n{line} {file}<\/pre>\n<\/li>\n<\/ol>\n<p>It&#8217;s worth mention that Unity only sends the\u00a0<em>line<\/em> information to the external editor when the name of the executable is\u00a0<em>monodevelop.exe<\/em>. Any other executable name won&#8217;t receive this information.<\/p>\n<h3>Configuring the Language Help<\/h3>\n<p>This enables <strong>Ctrl-F1<\/strong> to search for information on the word under the cursor at the Unity help page.<\/p>\n<ol>\n<li>Plugins &gt; Plugin Manager &gt; Show Plugin Manager<\/li>\n<li>Find <strong>Language Help<\/strong>, select its checkbox, click Install.<br \/>\nIf automatic install fails you can <a href=\"https:\/\/sites.google.com\/site\/fstellari\/nppplugins\" target=\"_blank\">download it here<\/a> and install it manually.<\/li>\n<li>Plugins &gt; Language Help &gt; Options<\/li>\n<li>Click Add, enter the following data, and Ok:<br \/>\nName: Unity 3D<br \/>\nExtensions\/file mask:\u00a0*.cs;*.js;*.boo;*.shader;*.compute<br \/>\nExtended help file path:\u00a0http:\/\/docs.unity3d.com\/Documentation\/ScriptReference\/30_search.html?q=$word$<\/li>\n<li>Optional: <em>Show entry in context menu<\/em> (allow search by right clicking a word in the editor)<\/li>\n<\/ol>\n<h3>Optional: Create your own theme<\/h3>\n<p>This prevents future updates of Notepad++ to override your changes. They will be persistently stored in your own theme:<\/p>\n<ol>\n<li><span style=\"line-height: 13px;\">Settings &gt; Style Configurator<\/span><\/li>\n<li>Select Theme: choose the theme that better fits your style. This will be your base theme.<\/li>\n<li>Find the theme name in the <em>Themes<\/em> folder inside the Notepad++ folder and make a duplicate. Give the file a proper name (i.e. <em>My Style<\/em>). This is the name that will be shown at the themes list.<br \/>\nIf you want to use the default theme then make a duplicate of the file\u00a0<em>stylers.xml<\/em><em><br \/>\n<\/em> and place it inside the Themes folder.<\/li>\n<li>Restart Notepad++<\/li>\n<li>Settings &gt; Style Configurator. Choose your theme. Click Save&amp;Close.<\/li>\n<\/ol>\n<p>Hints:<\/p>\n<ul>\n<li>Some times you will prefer to edit directly the file\u00a0<em>My Style.xml<\/em>\u00a0instead of using the Style Configurator. For instance: a custom background color can be configured in Global Overrides, but if you want to use background colors in some of your styles then you should change the background globally on all styles using search &amp; replace in the xml file.<\/li>\n<li>Set the global styles first, then focus on a single language each time.<\/li>\n<li><a href=\"http:\/\/npp-community.tuxfamily.org\/documentation\/notepad-user-manual\/settings\/styler-configurator\">Information on the Style Configurator an the global styles<\/a>.<\/li>\n<\/ul>\n<h3>Enabling syntax highlight<\/h3>\n<p>Unity keywords are located in this file (use\u00a0&#8220;Program Files (x86)&#8221; on 64-bit systems):<\/p>\n<p style=\"padding-left: 30px;\">C:\\Program Files\\Unity\\Editor\\Data\\Tools\\UniSciTE\\unitykeywords.properties<\/p>\n<p>Open it at Notepad++. The line 2 contains all the keywords.<\/p>\n<p><strong>Optional: Ensure that Notepad++ will recognize all keywords (also the ones inside the enums)<\/strong><\/p>\n<p>The enums are composed like in <em>KeyCode.Keypad0<\/em>, with the dot. Notepad wouldn&#8217;t recognize Keypad0 as keyword, not even when used with KeyCode.<\/p>\n<p>This can be fixed with some massaging to the unitykeywords.properties file. The TextFX plugin for Notepad++ helped a lot. This may be somewhat advanced and I won&#8217;t go into the details. You can always use the keywords as they come but some of them won&#8217;t be highlighted.<\/p>\n<ol>\n<li><span style=\"line-height: 13px;\">Use a macro (record &amp; repeat) for removing all dots and the each word preceding a dot.<br \/>\n(if you are good with RegEx you&#8217;ll surely find an easier way using the Search &amp; Replace function)<\/span><\/li>\n<li>Select a single space character and copy it to the clipboard<\/li>\n<li>TextFX &gt; TextFX Edit &gt; <em>Split lines at (clipboard characer) or , (VB)<\/em><br \/>\nA this time you may want to search for KeyCode and remove the spare letters A to Z. I don&#8217;t see the point of having these highlighted, but it&#8217;s up to you.<\/li>\n<li>Select All (and keep all selected for the next operations)<\/li>\n<li>TextFX Tools &gt; check <em>Sort outputs only UNIQUE (at column) lines<\/em><\/li>\n<li>TextFX Tools &gt; <em>Sort lines case sensitive (at column)<\/em><\/li>\n<li>TextFX Edit &gt; <em>Unwap text<\/em><\/li>\n<\/ol>\n<p>All keywords are now unique, without dots, sorted, and grouped in a single line.<\/p>\n<p><strong>Add the keywords to Notepad++<\/strong><\/p>\n<p>Once you have the text line with all the keywords:<\/p>\n<ol>\n<li>Settings &gt; Style Configurator.<\/li>\n<li>Select the language you want to add the keywords too (typically C# or Javascript).<\/li>\n<li>Select KEYWORD or INSTRUCTION WORD. A text area labeled\u00a0<em>User-defined keywords<\/em> should appear.<\/li>\n<li>Type an unique word, whatever, at the User-defined keywords area. For instance, type\u00a0<em>myuniquekeyword.<\/em>\u00a0If the text area already contains keywords, add yours at the end.<\/li>\n<li>Save &amp; Close.<\/li>\n<li>Open the xml file for your theme in Notepad++ (or <em>stylers.xml<\/em>\u00a0if you&#8217;re modifying the default theme).<\/li>\n<li>Search (Ctrl-B) for <em>myuniquekeyword<\/em> (or whatever word you&#8217;ve typed at step 4).<\/li>\n<li>Replace that word with the entire keywords line obtained from the file <em>unitykeyword.properties<\/em>.<\/li>\n<li>Save the file and restart Notepad++.<\/li>\n<\/ol>\n<p>Repeat for each language you want to set the keywords to.<\/p>\n<h3>Enabling auto-completion and hints for function parameters<\/h3>\n<p>Settings &gt; Preferences &gt; Backup\/Auto-Completion &gt; <em>Enable auto-completion on each input<br \/>\nSettings &gt; Preferences &gt; Backup\/Auto-Completion &gt;\u00a0<em>Function parameters hint on input\u00a0<\/em><br \/>\n<\/em><\/p>\n<p><em>Word completion<\/em> only completes keywords. <em>Function completion<\/em> completes keywords and functions.\u00a0The lists of words that feed these features are at the folder &lt;Notepad&gt;\\plugins\\APIs, named as their corresponding language.<\/p>\n<p>Unity auto-completion information is located here (use\u00a0&#8220;Program Files (x86)&#8221; on 64-bit systems):<\/p>\n<p style=\"padding-left: 30px;\">C:\\Program Files\\Unity\\Editor\\Data\\Tools\\UniSciTE\\UnityCS.api<\/p>\n<p>Needs to be converted to the Notepad++ XML format:<\/p>\n<ol>\n<li><span style=\"line-height: 13px;\">Download the <a href=\"http:\/\/dl.dropbox.com\/u\/25260770\/Unity-Notepad%2B%2B\/UnityJSapi_to_Npp.py\">UnityJSapi_to_Npp.py<\/a> script by <a href=\"http:\/\/wiki.unity3d.com\/index.php\/User:AnomalousUnderdog\">AnomalousUnderdog<\/a>.<br \/>\n<\/span><\/li>\n<li>Edit the first lines for specifying the proper routes and files.<\/li>\n<li>Run the script with Python.<\/li>\n<\/ol>\n<p>The resulting file <em>Unity_to_Npp.txt<\/em>\u00a0can now be merged with the auto-complete files. Important: <strong>the Keyword tags of the merged file must be sorted by their name property<\/strong>.<\/p>\n<ol>\n<li><span style=\"line-height: 13px;\">Open both <em>Unity_to_Npp.txt<\/em>\u00a0and the auto-complete file (typically <em>cs.xml<\/em> or\u00a0<em>javascript.xml<\/em>) in Notepad++.<\/span><\/li>\n<li>Copy all the contents of <em>Unity_to_Npp.txt<\/em> and paste them in the xml file somewhere inside the &lt;AutoComplete&gt; tag.<\/li>\n<li>Apply the same indentation to all &lt;keyword&gt; lines. You may do so by selecting the newly pasted lines and using TAB \/ Shift-TAB.<\/li>\n<li>Select all the &lt;keyword&gt; lines.<\/li>\n<li>TextFX &gt; TextFX Tool &gt; <em>Sort lines case insensitive (at column).<\/em><\/li>\n<\/ol>\n<p>Repeat for each language you want to set the auto-completion to.<\/p>\n<p>Note that changes on files in the API folder are not persistent when updating Notepad++. You should make backup copies of the modified xml files.<\/p>\n<h3>Goodies for improved usability<\/h3>\n<p><a href=\"http:\/\/superuser.com\/questions\/401551\/notepad-cursor-past-end-of-line-virtual-spaces\">Enabling Virtual Spaces \/ Cursor past end of line<\/a><\/p>\n<p>Allows the cursor to be placed and moved anywhere in the workspace, not only over actual lines of text.<\/p>\n<p><strong>ScrollPastEOF plugin<\/strong><\/p>\n<p>Allows to scroll up to one page beyond the end of the file. Useful for not having to append text to files by watching at the very bottom of the screen (nor having to insert empty lines).<\/p>\n<p>Use the Plugin Manager (Plugins &gt; Plugin Manager) for install this one.<\/p>\n<p><strong>Ctrl-PageUp, Ctrl-PageDown: cursor to top \/ bottom of the current page<\/strong><\/p>\n<p>This is is a handy feature for quickly moving the cursor, and seems to have been &#8220;forgotten&#8221; to include in the default shortcuts:<\/p>\n<ol>\n<li>Settings &gt; Shortcut Mapper &gt; Scintilla commands<\/li>\n<li>SCI_STUTTEREDPAGEUP -&gt; Ctrl + Page up<br \/>\nSCI_STUTTEREDPAGEDOWN -&gt; Ctrl + Page down<br \/>\nSCI_STUTTEREDPAGEUPEXTEND -&gt; Ctrl + Shift + Page up<br \/>\nSCI_STUTTEREDPAGEDOWNEXTEND -&gt; Ctrl + Shift + Page down<\/li>\n<\/ol>\n<p>The last two allows to extend the text selection to the top\/bottom of the page.<\/p>\n<h3>Bonus<\/h3>\n<p><strong>Using Notepad++ as default editor for GIT<\/strong><\/p>\n<p>This will make GIT invoke Notepad++ for all its text editing tasks instead of the actual vi, or vim, or whatever thing is that:<\/p>\n<pre>git config --global core.editor \"'C:\/Program Files (x86)\/Notepad++\/notepad++.exe' -multiInst -notabbar -nosession -noPlugin\"<\/pre>\n<p>The command line switches makes Notepad++ to open the file requested by GIT in a separated, isolated instance that doesn&#8217;t interfere in any way with your current working session.<\/p>\n<p><strong>Adding code-formatting tools<\/strong><\/p>\n<p><a href=\"http:\/\/www.blogetcetera.com\/2012\/adding-code-formatting-tools-notepad\/\">http:\/\/www.blogetcetera.com\/2012\/adding-code-formatting-tools-notepad\/<\/a><\/p>\n<h3>Bonus++: Configuring the appearance of MonoDevelop<\/h3>\n<p>You can completely customize the look and feel of MonoDevelop, so it&#8217;s more pleasant to use when you have to (i.e. for debugging Unity 3D code).<\/p>\n<ol>\n<li>Download the <strong>GTK+ Themes<\/strong> and <strong>GTK+ Theme Switcher<\/strong> zip files and\u00a0extract both them to a temporary directory:\n<p><a title=\"GTK+ Themes\" href=\"http:\/\/downloads.sourceforge.net\/gtk-win\/gtk2-themes-2009-09-07-win32_bin.zip\">http:\/\/downloads.sourceforge.net\/gtk-win\/gtk2-themes-2009-09-07-win32_bin.zip<\/a><br \/>\n<a title=\"GTK+ Theme Switcher\" href=\"http:\/\/downloads.sourceforge.net\/gtk-win\/gtk2_prefs-0.4.1.bin-gtk2.10-win32.zip\">http:\/\/downloads.sourceforge.net\/gtk-win\/gtk2_prefs-0.4.1.bin-gtk2.10-win32.zip<\/a><\/li>\n<li>Copy the <strong>lib<\/strong> and <strong>share<\/strong> folders to the MonoDevelop&#8217;s folder, merging the contents with the existing lib and share folders.<\/li>\n<li>Copy the executable (<strong>gtk2_prefs.exe<\/strong>) to the <strong>bin<\/strong> folder of MonoDevelop and run it (gtk2_prefs, not MonoDevelop).<\/li>\n<\/ol>\n<p>A list of the all available themes appear. Selecting them changes the theme of the window so you can preview\u00a0them. Also, click the &#8220;show preview&#8221; button for an extended preview.\u00a0Ensure to select the option &#8220;Use theme default font&#8221;! (or choose the font of your liking).<\/p>\n<p>These themes look very nice with MonoDevelop:<\/p>\n<ul>\n<li>Darklooks<\/li>\n<li>LighthouseBlue<\/li>\n<li>Nimbus (my personal favorite)<\/li>\n<li>Unity<\/li>\n<\/ul>\n<p>When done, click Ok and open MonoDevelop.<\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Notepad++\u00a0(version 6.3 at the time of writing this) UnitEd Redirector Keywords file for Unity 4\u00a0(for\u00a0Add the keywords to Notepad++ below) Auto-completion info for Unity 4\u00a0\u00a0(for\u00a0Enable auto-completion and hints for function parameters below, file is already parsed with the Python script) Edy.xml, cs.xml and javascript.xml files for Notepad++: &#8211; Edy.xml is my own theme which [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":685,"parent":228,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"pagetpl-onecolumn.php","meta":{"footnotes":""},"class_list":["post-666","page","type-page","status-publish","has-post-thumbnail","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/P1PjRF-aK","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/666","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/comments?post=666"}],"version-history":[{"count":19,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/666\/revisions"}],"predecessor-version":[{"id":688,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/666\/revisions\/688"}],"up":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/228"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/media\/685"}],"wp:attachment":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/media?parent=666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}