Page 3 of 4

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Mon Jun 07, 2010 12:37 pm
by peterb
aliasmask:

Thanks for the zip file! :)

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Mon Jun 07, 2010 3:24 pm
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.

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Sun Aug 01, 2010 11:03 pm
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?

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Mon Aug 02, 2010 9:27 am
by Azhrei
I'll post my files some time this week.

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Thu Dec 01, 2011 12:16 pm
by silverfields1
Is this VIM code still available? I'm not sure where is the correct place to look to download it. Thanks.

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Fri Dec 02, 2011 8:42 am
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.

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Fri Dec 02, 2011 1:03 pm
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.

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Fri Dec 02, 2011 4:42 pm
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).

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Mon Mar 16, 2015 2:20 pm
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.

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Thu Mar 26, 2015 7:30 am
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?

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Thu Mar 26, 2015 10:00 am
by aliasmask
Avoid the problem?

Code: Select all

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

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Thu Mar 26, 2015 10:11 am
by RPTroll
I didn't know you could do that. %{} embeds a variable in a string. Wow.
[Edit]
But that didn't fix it.

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Thu Mar 26, 2015 10:19 am
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.

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Thu Mar 26, 2015 10:28 am
by RPTroll
So, I took out

Code: Select all

syntax match input Value /VALUE\s*=\s*\S\+/ contained
and it stopped having the problem.

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Posted: Fri Mar 27, 2015 6:12 am
by RPTroll
I've placed the plugin files on github if anyone wants to contribute. Repository URL is https://github.com/rkathey/mtgvim.git