Search Unity

As you  may have heard before every friday we spend our time working on personal projects.

I have been working on a Unity Javascript mode for Emacs for a few weeks ago and now is in a state that is usable enough to share with the community :).

emacs UnityJS

As you can see it colors comments (multiline and single line), has support for basic data types, and also supports string coloring.

It also colors function declarations, if – else decisions, while and for/foreach loops and most importantly, it colors all the Unity functions supported by the engine!

Feel free to modify it. Also if you do anything interesting that can be added to the mode just let me know!

If I have time I’ll add a function to open the browser and search the docs for the word where the cursor is positioned. If for some reason you make it before I can, then just contact me and I’ll add it to the mode :).

Anyway, if you, like me, are an emacs addict, you can grab this mode from here: unityjs-mode.el

To make it work, just add this to your .emacs:

;; UnityJS mode for emacs
(autoload ‘unityjs-mode “unityjs-mode” “Major mode for editing Unity script code.” t)
(require ‘unityjs-mode)

;; UnityJS mode for emacs
(autoload 'unityjs-mode "unityjs-mode" "Major mode for editing Unity Javascript code." t)
(require 'unityjs-mode)

And make sure to load the path where you are going to store the mode ;).

7 replies on “Emacs mode for Unity Javascript”

One of autoload or require are useless. The require loads the library immediately, the autoload defers it until unityjs-mode is invoked. Autoloading makes start up faster, and is usually preferable. This is what I would use:

(autoload ‘unityjs-mode “unityjs-mode” “Major mode for editing Unity Javascript code.” t)
(add-to-list ‘auto-mode-alist ‘(“\\.js\\'” . unityjs-mode))

[…] has been almost a year since I released an emacs mode for Javascript in Unity 2.x , now I’m releasing the same mode for Unity 3.x, the main difference between this mode and […]

@timmcd: Shouldnt be difficult if you know some elisp.
Actually, you can create a minor mode for Unity Javascript and use as Major mode js2-mode : ).
check this page:

This is where I got the info for creating the mode, you can create a minor mode with the words and it should work : )

@technicat: I’m using Aquamacs as well : ), and now I only write unity js on emacs : P

visual web developer express 2010 has a great java script IDE and it’s free. everyone that needs javascript IDE and has windows should take a look at VS2010. i encourage you to use C# however.

Comments are closed.