Tool Vim Syntax Highlighting with Functions

Sevion

The DIY Ninja
Reaction score
413
Description

I've just started using Vim for programming and was disappointed with the (v)JASS highlighting from jass.vim in Vexorian's signature. as it used default highlighting (or close to it) as TESH. Which is one I don't like.

Also, the attached settings file makes Vim startup defaulting ir_black and (v)JASS as well as defaulting Consolas 9pt font and the window maximized, which if you've used Vim before, is defaulted to not maximize on startup.

And why use Vim? Because it's a hell of a lot better than most (if not all) editors out there and is (to me) on par with Notepad++ depending on what I'm using them for. Also, Bespin :D

Trust me, once you get the hang of Vim, you'll love it. Plus, editing is such a breeze to learn. I've only really used Vim for maybe 6 hours. All that time was spent MAKING THIS TOOL. That's how intuitive this program is. When you see the syntax for configuration, it's very easy to pick up and understand.

My TESH is setup to look like:

Capture-1.jpg

Preview

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>C:\Windows\System32\Untitled.html</title>
<meta name="Generator" content="Vim/7.2">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#000000" text="#7c7c7c"><font face="monospace">
<span style="background-color: #000000"><font color="#3d3d3d">&nbsp;1 </font></span><font color="#ffffff"><b>scope</b></font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">Test</font></span><font color="#cd3700">&nbsp;</font><font color="#ffffff"><b>initializer</b></font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">Ini</font></span><br>
<span style="background-color: #000000"><font color="#3d3d3d">&nbsp;2 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff">private</font><font color="#cd3700">&nbsp;</font><font color="#ffffff"><b>struct</b></font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">s</font></span><br>
<span style="background-color: #000000"><font color="#3d3d3d">&nbsp;3 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0055aa"><b>unit</b></font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">u</font></span><br>
<span style="background-color: #000000"><font color="#3d3d3d">&nbsp;4 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0055aa"><b>player</b></font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">p</font></span><br>
<span style="background-color: #000000"><font color="#3d3d3d">&nbsp;5 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0055aa"><b>item</b></font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">i</font></span><br>
<span style="background-color: #000000"><font color="#3d3d3d">&nbsp;6 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff"><b>static</b></font><font color="#cd3700">&nbsp;</font><font color="#ffffff"><b>method</b></font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">create</font></span><font color="#cd3700">&nbsp;</font><font color="#ffffff">takes</font><font color="#cd3700">&nbsp;</font><font color="#0055aa"><b>nothing</b></font><font color="#cd3700">&nbsp;</font><font color="#ffffff">returns</font><font color="#cd3700">&nbsp;</font><font color="#0055aa"><b>thistype</b></font><br>
<span style="background-color: #000000"><font color="#3d3d3d">&nbsp;7 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff">local</font><font color="#cd3700">&nbsp;</font><font color="#0055aa"><b>thistype</b></font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">dat</font></span><font color="#cd3700">&nbsp;= </font><font color="#0055aa"><b>thistype</b></font><font color="#0055aa">.</font><span style="background-color: #000000"><font color="#7c7c7c">allocate</font></span><font color="#cd3700">()</font><br>
<span style="background-color: #000000"><font color="#3d3d3d">&nbsp;8 </font></span><br>
<span style="background-color: #000000"><font color="#3d3d3d">&nbsp;9 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff">set</font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">dat</font></span><font color="#0055aa">.</font><span style="background-color: #000000"><font color="#7c7c7c">u</font></span><font color="#cd3700">&nbsp;= </font><font color="#008080">CreateUnit</font><font color="#cd3700">(</font><font color="#008080">GetLocalPlayer</font><font color="#cd3700">()</font><font color="#cd3700">, </font><font color="#ffff00"><b><i><u>'hfoo'</u></i></b></font><font color="#cd3700">, </font><font color="#0055aa">0</font><font color="#cd3700">, </font><font color="#0055aa">0</font><font color="#cd3700">, </font><font color="#0055aa">0</font><font color="#cd3700">)</font><br>
<span style="background-color: #000000"><font color="#3d3d3d">10 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff">set</font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">dat</font></span><font color="#0055aa">.</font><span style="background-color: #000000"><font color="#7c7c7c">p</font></span><font color="#cd3700">&nbsp;= </font><font color="#008080">GetLocalPlayer</font><font color="#cd3700">()</font><br>
<span style="background-color: #000000"><font color="#3d3d3d">11 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff">set</font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">dat</font></span><font color="#0055aa">.</font><span style="background-color: #000000"><font color="#7c7c7c">i</font></span><font color="#cd3700">&nbsp;= </font><font color="#008080">CreateItem</font><font color="#cd3700">(</font><font color="#ffff00"><b><i><u>'i000'</u></i></b></font><font color="#cd3700">, </font><font color="#0055aa">0</font><font color="#cd3700">, </font><font color="#0055aa">0</font><font color="#cd3700">)</font><br>
<span style="background-color: #000000"><font color="#3d3d3d">12 </font></span><br>
<span style="background-color: #000000"><font color="#3d3d3d">13 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff">return</font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">dat</font></span><br>
<span style="background-color: #000000"><font color="#3d3d3d">14 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff"><b>endmethod</b></font><br>
<span style="background-color: #000000"><font color="#3d3d3d">15 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff"><b>endstruct</b></font><br>
<span style="background-color: #000000"><font color="#3d3d3d">16 </font></span><br>
<span style="background-color: #000000"><font color="#3d3d3d">17 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff">private</font><font color="#cd3700">&nbsp;</font><font color="#ffffff"><b>function</b></font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">Ini</font></span><font color="#cd3700">&nbsp;</font><font color="#ffffff">takes</font><font color="#cd3700">&nbsp;</font><font color="#0055aa"><b>nothing</b></font><font color="#cd3700">&nbsp;</font><font color="#ffffff">returns</font><font color="#cd3700">&nbsp;</font><font color="#0055aa"><b>nothing</b></font><br>
<span style="background-color: #000000"><font color="#3d3d3d">18 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff">local</font><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">s</font></span><font color="#cd3700">&nbsp;</font><span style="background-color: #000000"><font color="#7c7c7c">dat</font></span><font color="#cd3700">&nbsp;= </font><span style="background-color: #000000"><font color="#7c7c7c">s</font></span><font color="#0055aa">.</font><span style="background-color: #000000"><font color="#7c7c7c">create</font></span><font color="#cd3700">()</font><br>
<span style="background-color: #000000"><font color="#3d3d3d">19 </font></span><br>
<span style="background-color: #000000"><font color="#3d3d3d">20 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff">call</font><font color="#cd3700">&nbsp;</font><font color="#008080">KillUnit</font><font color="#cd3700">(</font><span style="background-color: #000000"><font color="#7c7c7c">dat</font></span><font color="#0055aa">.</font><span style="background-color: #000000"><font color="#7c7c7c">u</font></span><font color="#cd3700">)</font><br>
<span style="background-color: #000000"><font color="#3d3d3d">21 </font></span><font color="#cd3700">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#ffffff"><b>endfunction</b></font><br>
<span style="background-color: #000000"><font color="#3d3d3d">22 </font></span><font color="#ffffff"><b>endscope</b></font><br>
<span style="background-color: #000000"><font color="#3d3d3d">23 </font></span><br>
</font></body>
</html>

How to Preview

Open your resident text editor (most commonly Notepad on Windows users' pc's).

Copy the code in the tags into it.

Save it as an html file (Replace .txt with .html and select All File Types then save)

Open it with your internet browser.

How to Install

Move _vimrc into PROGRAM FILES DIR\Vim\

Move jass.vim and cjass.vim and ir_black.vim into PROGRAM FLES DIR\Vim\vim72\colors\

NOTE: "vim72" is subject to change according to the installed version of Vim.

How to Edit

Don't like the current colors?

Then, edit it. It's fairly simple.

Go into ir_black.vim to change the colors and such.

Go into jass.vim or cjass.vim to change the words for highlighting.

Go into _vimrc to change stuff like fonts and start maximized.

_vimrc also contains the default syntax.

ir_black.vim will contain the colors for highlighting in the format:

Code:
hi Normal           guifg=#7C7C7C     guibg=black       gui=NONE      ctermfg=NONE        ctermbg=NONE        cterm=NONE

Change "Normal" to the name of the color type (HiLink GROUP to COLORTYPE).

Change guifg to the Hex color of your choosing. 7C7C7C is grayish. guibg=black is the background color. gui=NONE is effects like Bold, Underline, and Italics. ctermfg=NONE I have no idea. ctermbg=NONE I also have no idea. cterm=NONE No idea. I've not worked with them as of yet.

jass.vim includes the words in this format:

Code:
syn keyword jassType agent

syn declares a group, keyword declares the type of group, jassType is the name and agent the word to look for.

At the bottom of jass.vim there is also:

Code:
HiLink jassType	Type

This links jassType to the hi (hi in ir_black.vim) Type. If you add new groups, be sure to also remember to link them.

In _vimrc the only part you need to worry about is:

Code:
colorscheme ir_black
set guifont=Consolas:h9
set nu!
set ai!
syntax on
au GUIEnter * simalt ~x 
colorscheme jass

colorscheme ir_black makes it the black theme.
set guifont=Consolas:h9 makes the font Consolas with size 9.
set nu! enables line numbers.
set ai! enables autoindent.
syntax on enables syntax highlighting.
au GUIEnter * simalt ~x maximizes the window.
colorscheme jass enables JASS text highlighting.

Edit as you wish.

Other User Created JASS Schemes

  1. cJASS

NOTE: You better damn be grateful if you use Vim. And there better be a damn large Vim user community who codes in JASS. I broke my fingers editing those like 4000 lines. And I still have many more lines in Blizzard.j and common.ai to work through.
 

Attachments

  • JASS.zip
    21.2 KB · Views: 290
Not going to knock you for doing this for VIM, but there are so many other tools better than VIM. Eclipse is definitely leaps and bounds better.
 
I never could get the hang of Vim. I originally tried it on a friend's computer (he uses Debian, and in order to move around in the file you had to use the wasd keys, which is completely retarded).

I tried it out again later, and still couldn't figure out many basic things that I could do easily in PSPad (my current editor of choice).

I also tried Notepad++, but I was annoyed at the way the Preferences were set up.

My only problem with PSPad is its limited custom syntax highlighting.

Personally, the only thing I would like that TESH currently doesn't have, is an auto-complete for the code you've already written (without having to manually add it to the custom.j or whatever).
 
Yea, don't credit the person who helped you out :D
 
Why are you saving random files to your System32 directory :p

I'm not :p It's just what Vim generates when I convert it to HTML (which is very nice :D)

>Okay, stupid question. What's Vim?

I even linked it >_> It's like the 8th word on post 1. Vim with a link XD

I would certainly like to add AutoComplete. It's not something I've looked into yet, but I will ^_^

Steel, that's just your opinion :p I did this because I like Vim and because IMHO, the other jass.vim was incomplete :-/

>ReV

>_> All you did was introduce me to ir_black :p I was going to originally use darkblue since it kind of matched my TESH setup already. But black does look good too ^_^

Darthfett, I don't use WASD keys >_> Though, I like it, not only for the syntax highlighting, but for the command console ^_^ It's really nice :D

Anywho, I seriously think you should try Vim again :-/ It's actually really nice once you get the hang of it.

I really didn't like PSPad :-/

Also, Notepad++ what do you find bad about it? I personally like it :D
 
The fact still stands that this is a fantastic resource for Vim users.

Not going to knock you for doing this for VIM, but there are so many other tools better than VIM. Eclipse is definitely leaps and bounds better.

All these mentions about other tools here are kind of... pointless because this was made for Vim, not for those other tools.

I guess if you like to use Vim and what not, then this is a great tool for you.

If you use other tools, then it's obviously useless, lol.

Let's not get into wars over which is better and what not =).

So Vim Users Rejoice, you now have great syntax highlighting : D.
 
Good point, let's stop all talk about other editors.

Comments?

Also, would anyone actually like to help me do the BJ's ._.'
 
Update: New cJASS syntax highlighting has been added ;) Uses the same highlighting as my (v)JASS does with the added cJASS keywords.
 
Update: Both (v)JASS and cJASS syntax highlighting have been updated to include all BJ functions and the "hook" keyword!

Plus some fixes on some highlighting bugs.

Anyone else want to make more styles?
 
I really dislike your TESH style. o_O
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top