View Single Post
Old 10-22-2009, 08:23 PM   #1
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default JASS2, vJass and Zinc edit modes for jEdit (v9)

I've been starting to love the text editor called jEdit. It is very flexible, it is cross platform, it has INDENTATION-BASED FOLDING. And well... So much that I made edit modes for zinc and vjass for jEdit so that it can highlight them

jEdit
jEdit is free as in beer and freedom, so you may download it for free, it also supports windows, OS/X and Linux just fine. But it requires the Java runtime environment.

So, you'll need to download and install it in your OS:
http://www.jedit.org/

The files
The zip file contains three xml files which you should copy to a sub-folder called modes which is inside your jEdit settings directory.

After copying the files, you need to add a catalog entry. To this, open the file called 'catalog' that is inside your modes folder, it should look like this:
Code:
<?xml version="1.0"?>
<!DOCTYPE MODES SYSTEM "catalog.dtd">

<MODES>

<!-- Add lines like the following, one for each edit mode you add: -->
<!-- <MODE NAME="foo" FILE="foo.xml" FILE_NAME_GLOB="*.foo" /> -->

</MODES>
Simply add these lines before </MODES> :

Code:
<MODE NAME="wc3-jass" FILE="jass.xml" FILE_NAME_GLOB="{*.ai,common.j,blizzard.j}" />
<MODE NAME="wc3-vjass" FILE="vjass.xml" FILE_NAME_GLOB="{!{common,blizzard}}.j" />
<MODE NAME="wc3-zinc" FILE="zinc.xml" FILE_NAME_GLOB="*.zn" />

Then save it.

Now:
* If you open blizzard.j, common.j or an .ai file, you get JASS2 syntax highlight (without vJass extensions)
* If you open other file ending with .j, you get vJass highlighting.
* If you open a file with extension .zn you get Zinc highlighting.
* If you want to change to one of the modes when when editing a file, you may go to utilities\buffer options and then find the modes called "wc3-jass", "wc3-vjass" and "wc3-zinc".


If you want to change the color/format of a syntax element, select it and then go to Utilities\Quick settings\Edit syntax style of token under carret.

This thing is very powerful, first time since gvim I am able to actually have correct code folding, nested /* */ comments, and line breaks inside strings. Plus it is not as hard as gvim, so...

Edit: Also, for example, The contents //! zinc tags inside a vJass file will switch to zinc highlighting mode. And //! novjass will switch to Jass2 mode. That's cool?

I managed to actually highlight stuff inside preprocessor lines, but they won't highlight elsewhere...

Assorted jEdit tips
* You should probably go to global options the first time to tweak jEdit, its default config are kinda strange... For example, to disable the periods at the end of the lines go to the "Global options" button, then "Text Area" then uncheck "end of line markers"

* You can make it use tabs: Go to plugins and install two plugins: "BufferTabs" and "GNURegexp", let it download and install those plugins then go to plugin options and go to the BufferTabs part to enable them.

* To have cute indentation markers like in the screenshot, install the Whitespace plugin.

* This can do autocomplete: Whenever you can't think of a keyword/native/bj function name, press ctrol+b after typing something.
Attached Images
File Type: png newscreen.png (90.5 KB, 2439 views)
Attached Files
File Type: zip wc3.jEdit.v9.zip (24.9 KB, 1030 views)
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Sponsored Links - Login to hide this ad!