Murga-Projects Forums

Full Version: Vim syntax file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been poking at Vim's lua syntax file for quite a while now, adding little bits here and there from murgaLua. Since i recently started exploring the built-in tables in murgaLua, i've found it now much easier to work on my syntax file.

This is not a complete syntax file, but instead is a complement to the existing Lua syntax file. In order to make it work, create the directory <vim_path>/after/syntax/ and add this file to that direcory as lua.vim

Edit: I made some drastic changes to it that reduced the filesize but made individual lines extrememly long. Rather than posting the text, the file is attached.
I think I'll try this out tonight :-)


Updated the original post with the additions from this morning. I've gotten as far as Fl_Text_Display with searching the individual widgets.

I don't quite understand the syntax of some parts of murgaLua...some things seem to be inconsistent with the majority (such as Fl_Shared_Image), so there are and may be in the future minor changes to those things. For example, I had originally used "Fl_Shared_Image.get" as a syntax string, but discovered that Fl_Shared_Image has most of the same methods as other image objects, so changed it simply to "Fl_Shared_Image". This means any script that currently uses "Fl_Shared_Image<dot>get" rather than "Fl_Shared_Image<colon>get" won't fully highlight that string.

That colon-or-dot thing makes my head hurt. It makes no sense to me.

Also, a note about the actual colors used:
I chose keywords that produced colors that looked comfortable to me, rather than focusing on the relationship of the keyword to the actual type of object is being highlighted. This might be annoying to some people.
Another update. I'm going to consider this a completed project for now so I can get back to other things. I'm sure it will still need some work in the future, but nearly everything in murgaLua 0.5.5 is covered.

It's been changed to use expressions to cut down the long series of commands, so hopefully it will be easier to use/edit.

Edit: I carelessly omitted a vital part of the syntax patterns (end-of-word), so there were a lot of badly-detected words in the previous upoad. I've replaced it with a fixed version (Monday 16:40 EST)
I've been gradually adding bits to the file as features are added to murgaLua and as I notice things I've overlooked, but one serious thing I've overlooked is that some functions can be used as a method by a named object. For example, here's a small piece from a script in Damn Small Linux:

timeserver = socket.tcp()
_,err = timeserver:connect(host,port)

The current syntax file properly matches socket.tcp, but the other functions are not matched. If it was socket.connect it would be matched, but instead the script uses timeserver:connect.

I believe I'm going to have to rethink my method of matching strings If I'm going to address these variables without making the file too huge.
Maybe I'll simplify it so that all keywords are matched regardless of their context. I've seen it done this way in other syntax files, where certain keywords are highlighted regardless of their context. I was trying to be specific so these words would not be highlighted unless they are technically supposed to be, but that's beginning to become more complex than I'd like.

I added a lot of the newer stuff to it, and did a simple fix that should address the previous problem.

It still is incomplete, but it will be an ongoing process. updated file at top
An update for MurgaLua 0.7.0
Still kinda sloppy, still incomplete, but still works. updated file at top

EDIT: I added the fann stuff to my own copy today, as well as the additional fltk bits that have been put in over the last couple of ML releases. But I'm looking into learning more about the way these syntax files are built so I can streamline it more before uploading the newer version.
Two months later and I still haven't gotten back to it.
So I'll just post what I have now, since I probably won't get back to it again for a while.
Reference URL's