Search Unity

Replacing UniSciTE with Notepad++

Discussion in 'External Tools' started by AnomalusUndrdog, Apr 2, 2010.

  1. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,493
    Notepad++ is a powerful text editor based on Scintilla (which is where UniSciTE is also based from). It is available only in Windows.

    I've managed to make use of Notepad++ as a replacement text editor for Unity.

    * it can manage more than ten text files opened simultaneously
    * customizable color scheme


    I turned this into a wiki page by the way: http://www.unifycommunity.com/wiki/index.php?title=Using_Notepad_Plus_Plus_as_a_script_editor


    Directions:

    1. Notepad++ can be found in http://notepad-plus.sourceforge.net/uk/site.htm

    Download and install.

    2. Change your External Script Editor to Notepad++ (In Unity, Edit> Preferences > General)

    3. Unity should now open Notepad++ whenever you double-click a script (or any text file actually).



    To add searching of Unity Documentation within Notepad++:

    1. 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.
    2. Go to Plugins > Language Help > Options...
    3. Click Add and put these values
    Name: Unity
    Extension List: js
    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.



    To enable highlighting of unity "keywords":

    1. Open C:\Program Files\Unity\Editor\Data\Tools\UniSciTE\unitykeywords.properties

    This text file contains all the unity keywords.


    2. 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.)

    3. Find "<LexerType name="javascript" desc="Javascript" ext="">"

    4. Find the <WordsStyle name="KEYWORD" styleID="47" fgColor="000080" bgColor="F2F4FF" fontName="" fontStyle="3" fontSize="" keywordClass="instre1">

    5. Insert all the unity keywords (found from the unitykeywords.properties you opened earlier) inside that <WordsStyle name="KEYWORD"> tag

    6. Save it. Close and open Notepad++. It should highlight the Unity keywords now.



    How to add Intellisense (called Auto-Completion in Notepad++) for Unityscript:

    1. Turn on Auto-Completion by going to: Settings > Preferences > Backup/Auto-Completion. Check "Function parameters hint on input"

    1. Open C:\Program Files\Notepad++\plugins\APIs\javascript.xml (or cs.xml if you use C#).

    2. Copy paste contents of https://dl.dropbox.com/u/25260770/Unity-Notepad++/UnityApi_to_Npp-3.5.txt to anywhere inside the <AutoComplete> tags of the xml file.

    3. Close and open Notepad++. A function tooltip should now appear whenever you type in an open parenthesis after a Unity function.

    Note: The UnityJS_to_Npp.txt is created from the file found as C:\Program Files\Unity\Editor\Data\Tools\UniSciTE\UnityJS.api, converting it using a program I made (http://dl.dropbox.com/u/25260770/Unity-Notepad++/UnityJSapi_to_Npp.py). If ever the UnityJS.api changes (in case of a Unity update), just edit and run the python script.


    How to make Notepad++ jump to the correct line number from the error console

    Change the external script editor's command line arguments in the Unity preferences window. See the part about "External Tools" in http://docs.unity3d.com/Manual/Preferences.html
     

    Attached Files:

    Last edited: Jun 14, 2014
  2. KHopcraft

    KHopcraft

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Sweetness.
     
  3. KHopcraft

    KHopcraft

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Adding highlighting and auto completion does not work for me. What version do you have?
     
  4. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,493
    5.6.8

    Maybe my directions are a bit confusing. Here's a stylers.xml (zipped) file preedited with Unity keywords, put it on C:\Program Files\Notepad++\ overwrite the old file.

    Here's also a javascript.xml (zipped) put it in C:\Program Files\Notepad++\plugins\APIs, overwrite the old file
     

    Attached Files:

  5. KHopcraft

    KHopcraft

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    So very very close. Just the highlighting is not working.

    Edit: Fixed it, I went into the toolbar and clicked setting, then Style configurator, language javascript, and style keywords. I added in all the terms on the bottom right box.

    Thanks for the help :D.
     
  6. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,493
    That might not add all keywords as the text box only accepts so much text and the Unity keywords are so many.

    Try typing "zero", it should highlight. If not, edit your stylers.xml file and make sure it includes all keywords.
     
  7. KHopcraft

    KHopcraft

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    I will tomorrow. I am just going to bed. Thanks for ze help.:D
     
  8. ockky

    ockky

    Joined:
    Dec 11, 2009
    Posts:
    18
    Well done mate!

    I had already replaced the default editor with NPP, but not to this extent. Now if you could include steps for C# you dirty slacker :)
     
  9. KHopcraft

    KHopcraft

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Monodevelop is good for C#!
     
  10. JimmyC

    JimmyC

    Joined:
    Oct 30, 2009
    Posts:
    16
    It doesn't work for me either, and I d/l both of your files and installed them. There was no styler.xml in my folder, just styler model.xml (I have just update Notepad++ to the latest version)

    I put styler.xml in the correct folder, but it does not highlight Abs or zero. I am at a loss. I have quit out of Unity and Notepad++, and reloaded Unity, dbl clicked on a script and Notepad++ came up OK, but no highlighting.

    Thanks for your help, and the files, it is a great idea, and i will love it when I get it to work.

    Have you any ideas?
     
  11. KHopcraft

    KHopcraft

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Go into your notepad++ folder, then in to the themes folder.
    Which ever theme you are using, do the instructions.
    If you are using the default, then try renaming his stylers.xml to styles.xml.
     
  12. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,493
    Oh, you were using a different theme! Ok, I changed the instructions to account for that fact.
     
  13. JimmyC

    JimmyC

    Joined:
    Oct 30, 2009
    Posts:
    16
    I thought you couldn't get it to work?

    Stylers is the correct name, and I don't use any themes. I think the problem may be a slight change in syntax in the latest version of NP++ with the closing tag.

    I'll mess around some more.

    Thanks.
     
  14. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,493
    It should be fairly easy to do it, whenever I mention javascript in my instructions, just look for the C# equivalent, for example, instead of looking for <LexerType name="javascript" desc="Javascript" ext="">, look for <LexerType name="cs" desc="C#" ext="">.

    And the UnityJS.api I checked with UnityCS.api, their md5 hashes are a match, so the files I created should work too for C#. Just open cs.xml instead of javscript.xml
     
  15. KHopcraft

    KHopcraft

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Let me just quote myself:
    For me the file name is not stylers.xml. Actually, there wasn't a file like that at all.
     
  16. JimmyC

    JimmyC

    Joined:
    Oct 30, 2009
    Posts:
    16
    That doesn't work! Only a fraction of the words appear in that box. I thought you had fixed it some other way.

    @ anomalous_underdog

    I still can't get it to work. I am using 5.6.8 which I just updated tonight. I will see if I can find my previous version on my HDD, and see if I can get that to work.

    Thank you for your effort in this matter. I never said i was using themes. It is just a bog standard install, and I floowed the instructions. I installed both of your files, and highlghting just wont work.
     
  17. KHopcraft

    KHopcraft

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Ya, so I ended up editing the theme xml file I use instead.
     
  18. JimmyC

    JimmyC

    Joined:
    Oct 30, 2009
    Posts:
    16
    I got it to work by adding the Keywords to the langs.xml file, and deleting the ones that were in there already for JS.

    The AutoComplete and the Help both work as well. Super job, I can't thank you enough for this anomalous_underdog. You are a star!
     
  19. Eki

    Eki

    Joined:
    Feb 2, 2010
    Posts:
    7
  20. Guru

    Guru

    Joined:
    Apr 30, 2010
    Posts:
    118
    AWESOME! Got it all to work...what I had to do was add the keywords to the lang.xml in the Javascript section after the default keywords (in order to keep them). If I added them to the Style Configurator it wouldn't highlight about 1/3 of the words, putting them directly in lang.xml highlights all words.

    To have Notepad++ jump to the correct line number you must back up the original uniscite.exe, copy THESE TWO FILES INTO THE UNISCITE DIR, and make sure you use the BUILT-IN editor...it will launch Notepad++ and go to the correct line when you double click on an error msg in the Unity error console.

    EDIT: This is per the instructions at the page listed above mine....google translate pages aren't the easiest thing to read when trying to follow directions sometimes lol

    EDIT: Updated Wiki with the relevant information to make it jump to the correct line location.
     
  21. zoultrex

    zoultrex

    Joined:
    Mar 11, 2010
    Posts:
    63
    I dont know why when I add the keywords in the langs.xml they dissapear after I reaload the file.

    Im having the same problem that many other had, adding the keyworkds to the stylers does not work :?
     
  22. Eki

    Eki

    Joined:
    Feb 2, 2010
    Posts:
    7
    Yeah ,
    I had this problem also, on one site I found the solution (can't find the site anymore).
    It seems btw that only some converted color schemes have this problem.


    replace the code of the stylers.xml at his location:
    C:\Users\"yourName"\AppData\Roaming\Notepad++
    with your preferred ones code, and voila yours will be the default, and everything will be stored, if you change it.

    I use the Bespin style and it realy saves my eyes,

    8)
     
  23. zoultrex

    zoultrex

    Joined:
    Mar 11, 2010
    Posts:
    63
    @Eki:

    Yay thank you so much :wink:
    That did it!

    And yea Bespin theme is the best :D
     
  24. newbrand

    newbrand

    Joined:
    May 13, 2010
    Posts:
    70
    Does anybody know how I can add another Keywords tag so that I can color the unity keywords differently from the js ones?
    I've been toying around with the xml-files for the last hour, but no gain.
     
  25. spaceMan-2.5

    spaceMan-2.5

    Joined:
    Oct 21, 2009
    Posts:
    710
    Anomalous... where did you get that soft theme ...
    i like it.. is really soft...
     
  26. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,493
    If you're talking about the screenshot, the title of the theme is "Obsidian". I really like it too :D
     
  27. JAMiller

    JAMiller

    Joined:
    Apr 2, 2009
    Posts:
    73
    Using the python script that the OP included, I updated the UnityJS_to_Npp.txt with the new Unity 3.0 functions if anyone wants them.

    Thanks, I love notepad++ and just now discovered this after year(s) of UnityDevelop.
     

    Attached Files:

    Last edited: Oct 7, 2010
  28. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Perfect timing! :) I've given up on using MonoDevelop for my .js coding and UniSciTe is just too limited. Just yesterday I started adding the tweaks to Notepad++ per the Wiki and so far is it -GREAT-!

    @UnityTech - If you're reading this, please dump UniShiite and replace it with NotePad++. It is sooo much better for us .js coders! :)
     
  29. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
  30. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,493
    I knew making a script that automates that paid off :)
     
  31. ironwolf

    ironwolf

    Joined:
    Oct 26, 2010
    Posts:
    7
    Try WordsStyle tag with parameters:
    styleID="16"
    keywordClass="type1"

    in your theme style xml or default stylers.xml

    I tried a lot of styleID's, and spend lot of time to figure it out, and I don't realy know why this one works, but it works :D
    Perhabs there is something in SciLexer.dll which can't be change with style.xml.
     
  32. priceap

    priceap

    Joined:
    Apr 18, 2009
    Posts:
    274
    I can't get the "intellisense" behavior to work. Everything else seems to be working ok, but I cannot get it to show any tooltip when entering a open parenthesis after a function. The entries have all been added manually to the javascript.xml file in the plugins/APis directory, and the function parameters hint checkbox turned on in the backup/completion preferences. I have tried multiple times and just can't get it to work. Can anyone suggest a way to test this, or if any other tricks had to be done to get it working?
    thanks
     
  33. priceap

    priceap

    Joined:
    Apr 18, 2009
    Posts:
    274
    OK, I got it working!
    The reason appears to be the "Unity3JS_to_Npp.txt" starts like this:
    " /><KeyWord name="Abs" func="yes"> "..........
    If I removed the ' "/> ' at the beginning of the file, it all works now.

     
  34. spaceMan-2.5

    spaceMan-2.5

    Joined:
    Oct 21, 2009
    Posts:
    710
    Excuseme i don´t understand where to put keywords in step 5 of Activating highlights,, i´´m using Obsidian , any help?.. i´m not so good in xml tags hehe.. Thanks..
     
  35. blisssan

    blisssan

    Joined:
    Dec 19, 2010
    Posts:
    2
    auto complete doesnt work when i keep " . " (dot) operator..it only completes when i us paranthesis...
    is there any way to make it work this way.
     
  36. monkeybrother

    monkeybrother

    Joined:
    Oct 14, 2010
    Posts:
    83
    Hi. I've been away from Unity for a while and have installed new versions of both Unity and Notepad++. All the notepad++ settings was reset when I updated and I can't get it to work again. It worked perfectly before, but now intellisense just doesn't work. I've followed the instructions and the tips in this thread, but nothing. Has anything changed in Unity 3.3 and/or notepad++?
     
  37. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Haven't tried customizing intellisense, but I did update Notepad++ highlighting for 3.2. I've found that (under Windows 7 at least) how that's done has changed and I made a comment in the wiki regarding that. Did you create a new "UnityJS_to_Npp.txt"? If so, post it in the wiki or here and I'll give it a try.
     
  38. monkeybrother

    monkeybrother

    Joined:
    Oct 14, 2010
    Posts:
    83
    No, I hadn't created a new file. I did now and it works. Thanks!
     
  39. karl_

    karl_

    Joined:
    Mar 4, 2010
    Posts:
    464
    Not to dig up an old thread, but does anyone have Unity opening Notepad++ up to the proper line working with 3.4? Everything else seems to be working fine except for clicking debug messages.
     
  40. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,493
  41. tiagomelo

    tiagomelo

    Joined:
    Jun 25, 2010
    Posts:
    18
  42. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,493
    You're right! It doesn't work! Time to take matters into my hands once more!

    I made this: http://dl.dropbox.com/u/25260770/Unity-Notepad++/UnityExternalScriptEditorHelper-1.0.7z

    Extract it, and follow the instructions found in the README.txt

    If you can't extract .7z files, install 7-zip (http://www.7zip.org/).

    I basically mimicked what SmokeyMonkeys' method did, but updated it, as well as allowed it to be more flexible so it can be used with any type of script editor.

    I have released that program in a BSD style license.
     
  43. Rond

    Rond

    Joined:
    Oct 21, 2009
    Posts:
    175
    Same here... i'm not good at xml, so I have no idea how to add the keywords inside the tag... Sorry for the dig..

    Edit: nvm, i just replaced the obsidian with the stylers on the first page of this topic...
     
    Last edited: Feb 28, 2012
  44. hadidx

    hadidx

    Joined:
    Aug 28, 2012
    Posts:
    29
    Great tutorial!! However, for some reason not all words auto complete. Examples : Translate , animation , GameObject. Am I doing something wrong?
    Thanks in advance.
     
  45. worldsbestboss

    worldsbestboss

    Joined:
    Mar 12, 2012
    Posts:
    86
    Sorry to rez a dead thread but I'm having this same problem too. I can't seem to get the highlighting to work even though I've placed all my keywords into the stylers.xml and obsidian.xml (theme I use). It looks like this

    <WordsStyle name="KEYWORD" styleID="47" fgColor="000080" bgColor="F2F4FF" fontName="" fontStyle="3" fontSize="" keywordClass="instre1 otherkeywordsp..." />

    But it doesn't seem to highlight anything. Am I doing something wrong?
     
  46. ZoomDomain

    ZoomDomain

    Joined:
    Aug 30, 2012
    Posts:
    150
    Hi Worldbest, I did the same, i followed the wiki guide word for word and nothing is highlighted.

    very one of us is trying to edit a crazy number of config files, while praying that we have the correct notepad++ version for it to work, in vain...

    It would be nice if someone could say which version of N++ this worked on.
    It would save many coders alot of time if someone uploaded a fully functioning zipped copy of notepad++ with unity keywords etc.

    So i will write to the people here that got it working and ask for a copy of the installed files to my mailbox, and then i'll try to upload it here.

    my mail is ant dot stewart at yahoo dot com, please zip me your N++ edited and working so i may send it around! thanks!
     
  47. LtKelleyUSMC

    LtKelleyUSMC

    Joined:
    Oct 6, 2012
    Posts:
    27
    Hey there fellow UNITY PROGRAMMERS,
    AnomalusUndrdog is correct. I was having trouble using the "BuiltIn MonoDevelop" in Unity3D,
    so I started out on this journey of fixing the BuiltIn editor, with many a solution, as to how everyone
    thought you could fix this.

    My problem was that I could not get the BuiltIn Editor to even start.

    So, I downloaded the latest version of Mono Develop. Once I got this installed, I could not get
    Mono Develop to load any javascript files, because it kept giving me an error

    Soooo, continued on this journey. Finally decided to UNINSTALL and REINSTALL Unity3D.
    Still had no luck on getting the editor to work...

    Soooo, I decided to set the Unity Editor to be NotePad++ (I already knew this program was AWESOME - Much flexibility)

    Then, I did some research on trying to get these keywords to come up, and ran across THIS PAGE.

    Again, I SALUTE you, AnomalusUndrdog, for, not only explaining how to get this to work, but
    for even coming up with the IDEA.

    Boy, I have really become spoiled on programming and the keywords getting lit up. It sure helps out
    when programming, instead of having to have the manual open (as in the old days of DOS and 'C').

    By the way, here is an image of the VERSION of NOTEPAD++ I am using:

    Thanks again.
    Works PERFECT!!!!!
     
    Last edited: Oct 6, 2012
  48. LtKelleyUSMC

    LtKelleyUSMC

    Joined:
    Oct 6, 2012
    Posts:
    27
    Hey there worldsbestboss,
    What you need to do, when editing <WordsStyle ...is the following:
    <WordsStyle name="KEYWORD"
    styleID="47"
    fgColor="000080"
    bgColor="F2F4FF"
    fontName=""
    fontStyle="3"
    fontSize=""
    keywordClass="instre1">Abs AcceptDrag Acos Add AddBinaryData AddClip ... </WordsStyle>

    Just be sure to have the word instre1 in Quotation marks ("), and end the WordStyle with </WordsStyle>, instead of the </>.
    NOTE that I am NOT talking about hitting the <ENTER KEY> after every word, like style="47" or fgColor="000080".
    I am only talking about putting the Abs AcceptDrag Acos... after you have put the "instre1">..
    In other words, add the keywords in between the "instre1"> and </WordsStyle>
    Love this forum...
     
    Last edited: Oct 6, 2012
  49. LtKelleyUSMC

    LtKelleyUSMC

    Joined:
    Oct 6, 2012
    Posts:
    27
    Just for Grins, I decided to upgrade my version of NotePad++ to 6.1.8
    Followed these steps, once again, from AnomalusUndrdog, and it worked perfectly, again.


     
    Last edited: Oct 6, 2012
  50. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,493
    Hi LtKelleyUSMC, you took the words right out of my mouth, I just finished revising the wiki page to explain how to prevent the problems some people are having with the highlighting.