MapTool Macros Vim Syntax Hilight/Completion/Doc

These are tools and utilities that make it easier to run games. This includes Lib: macro tokens dropped into MapTool to manage the game, a conversion file for CharacterTool to allow use in MapTool, or just about anything else you can think of -- except graphics with macros and anything specific to a particular campaign framework. Those are already covered by the Tilesets subforum and the Links and External Resources forum.

Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice

peterb
Kobold
Posts: 2
Joined: Fri Mar 27, 2009 7:34 am

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by peterb »

aliasmask:

Thanks for the zip file! :)

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by Azhrei »

I've updated the vim syntax commands to fix some highlighting issues and I should package that stuff up and attach it here. I'll try to get to that one evening this week, but if anyone is really hot for it let me know.

The changes aren't anything major, but I noticed that some strings inside input statements cause highlighting to fail if there's not a space before the last close quote, for example.

osman
Giant
Posts: 100
Joined: Sat Apr 12, 2008 12:23 pm
Location: Latham, NY

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by osman »

Any word on that, Azhrei? I've been running with an older version for a while now, but the highlighting errors are starting to bug me. It sounds like the latest one that's been posted still has those issues?

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by Azhrei »

I'll post my files some time this week.

silverfields1
Kobold
Posts: 9
Joined: Thu Nov 03, 2011 9:11 pm

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by silverfields1 »

Is this VIM code still available? I'm not sure where is the correct place to look to download it. Thanks.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by Azhrei »

Well, it looks like I've promised this twice. :( Instead of delaying further while I clean up the last few things and then package it up nicely, like Craig did, I'll just release the files themselves.

At some point (maybe tonight) I'll go back and release this as a set of patches. That way you'll be able to look at the patch and see exactly what I've changed.

Note that the syntax/ directory of the attached ZIP file has two files; the mtmacro.vim is the one that's used, the other is the original from Craig.

These files are from my ~/.vim/ directory so you'll need to put them wherever is appropriate for your platform. They do not contain any absolute pathnames so it shouldn't matter what directory you actually use as long as vim knows to look there.
Attachments
mtmacro-vim.zip
Updated syntax files for vim (entire fileset included)
(42.63 KiB) Downloaded 169 times

silverfields1
Kobold
Posts: 9
Joined: Thu Nov 03, 2011 9:11 pm

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by silverfields1 »

Thanks! No trouble installing.

I do have a question however; a good deal of text in my macro's are displayed as errors (red background, white foreground). Any idea why this would be? Some I understand, like spaces at the end of a line. But there is a lot more than just that.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by Azhrei »

I'd have to see the code.

There is one problem that I know of with the Vim syntax file: any input function must have a space before the closing quote -- the one that comes after the options. For example, if it ends with ICON=TEXT" it won't display the syntax highlighting properly, but add a space in front of the double quote and it'll work. :(

I remember looking for the fix at some point in the past, but I don't know if I fixed it or not (I think I didn't for some reason).

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by RPTroll »

Updated OP fixing links and images and adding in Az's modifications. I'll add the b91 macro functions to the dropbox file as time allows and post here when a new file is available.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by RPTroll »

This seems to give the GVIM plugin fits

[h:status=input(
"newType|"+types+"|Marker Type|LIST|SELECT="+index+" VALUE=STRING"
)]

It appears the the second = is escaping the preceding ". It restarts syntax highlighting on the ending ".

So I opened mtmacro.vim seeing if I could find the problem.

Code: Select all

" Special string values
syntax match propSep /;/ contained
syntax match listSep /;/ contained
syntax match inputSep /|/ contained
syntax keyword inputText TEXT contained
syntax keyword inputList LIST contained
syntax keyword inputCheck CHECK contained
syntax keyword inputRadio RADIO contained
syntax keyword inputLabel LABEL contained
syntax keyword inputProps PROPS contained
syntax match inputWidth /WIDTH\s*=\s*\d\+/ contained
syntax match inputSelect /SELECT\s*=\s*\d\+/ contained
syntax match inputValue /VALUE\s*=\s*\S\+/ contained
syntax match inputText /TEXT\s*=\s*\(FALSE\|TRUE\)/ contained
syntax match inputIcon /ICON\s*=\s*\(FALSE\|TRUE\)/ contained
syntax match inputIconSize /ICONSIZE\s*=\s*\d\+/ contained
syntax match inputOrient /ORIENT\s*=\s*[HV]/ contained
syntax match inputSetVars /SETVARS\s*=\s*\(FALSE\|TRUE\)/ contained

syntax match macroLoc /\c[^"']\+@token/ contained
syntax match macroLoc /\c[^"']\+@campaign/ contained
syntax match macroLoc /\c[^"']\+@global/ contained
syntax match macroLoc /\c[^"']\+@lib:[^"']\+/ contained
syntax match macroLoc /\c[^"']\+@this/ contained
I see the VALUE= string but don't fully understand how it interacts with "s. Any thoughts? Am I looking in the wrong spot?
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by aliasmask »

Avoid the problem?

Code: Select all

[h:status=input(strformat(
"newType|%{types}|Marker Type|LIST|SELECT=%{index} VALUE=STRING"
))]

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by RPTroll »

I didn't know you could do that. %{} embeds a variable in a string. Wow.
[Edit]
But that didn't fix it.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by aliasmask »

RPTroll wrote:I didn't know you could do that. %{} embeds a variable in a string. Wow.
[Edit]
But that didn't fix it.
Only with strformat(). There's probably something in the vim definitions file that you can use to tell it to ignore = inside of quotes, assuming = has some other meaning to the parser. I'm unfamiliar with the editor though, so no help from me.

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by RPTroll »

So, I took out

Code: Select all

syntax match input Value /VALUE\s*=\s*\S\+/ contained
and it stopped having the problem.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by RPTroll »

I've placed the plugin files on github if anyone wants to contribute. Repository URL is https://github.com/rkathey/mtgvim.git
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

Post Reply

Return to “Drop-In Macro Resources”