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

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by Craig »

Ferdil wrote:
Ah, ok, didn't know that (I tried the menu just because the plugin wasn't working), but even with the command :set filetype=mtmacro or opening a .mtm file doesn't work. It does not recognise the :help mtmacro command. It's like it's not installed. Maybe I did something wrong, I'm still quite a noob at vim.

P.S. I tried both on linux and on windows and it happens exactly the same thing. Maybe I'm doing something wrong?
Ahh Sorry I misunderstood.

I found the problem, the .vba file was wrong and had a missing file. I updated it so if you download it again and do the :so % it should work. Let me know if it is still a problem.

User avatar
Ferdil
Cave Troll
Posts: 31
Joined: Wed Jan 07, 2009 1:27 pm

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by Ferdil »

Craig wrote:
Ferdil wrote:
Ah, ok, didn't know that (I tried the menu just because the plugin wasn't working), but even with the command :set filetype=mtmacro or opening a .mtm file doesn't work. It does not recognise the :help mtmacro command. It's like it's not installed. Maybe I did something wrong, I'm still quite a noob at vim.

P.S. I tried both on linux and on windows and it happens exactly the same thing. Maybe I'm doing something wrong?
Ahh Sorry I misunderstood.

I found the problem, the .vba file was wrong and had a missing file. I updated it so if you download it again and do the :so % it should work. Let me know if it is still a problem.
It's working, and it's AWESOME! Thanks for the help and for the plugin!

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by Craig »

Ferdil wrote:
It's working, and it's AWESOME! Thanks for the help and for the plugin!
NP, at least I know I am not the only one using it ;)

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 »

Oh no, I'm sure there are at least ... oh, 6 or 7 people that use (and like) VI! :mrgreen:

Nonsapient
Cave Troll
Posts: 90
Joined: Thu Apr 23, 2009 6:37 pm

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by Nonsapient »

Craig wrote: This will install the plug in. The next step is to edit your vim configuration file, to do that then start vim.
In windows type

Code: Select all

: e! $HOME/_vimrc
Linux/Mac OSX

Code: Select all

:e! $HOME/.vimrc
Then add the following lines.

Code: Select all

filetype plugin on
syntax on
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
Save and quit

Code: Select all

:wq
When I try to do this step it doesn't seem to be opening the config file, but rather making a new file. I'm really unsure of how to find the correct file in windows. About the only thin nonstandard in my win install is that I use E: as my win drive (this causes numerous issues. you have no idea how many programs reference C: via hardcoding).

any help?

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 »

Windows VIM can put the vimrc file in a couple different places. If you don't have a home directory (or didn't check the option), it's more likely that it's in "Program Files\Vim" (I guess on your E drive). You can also get VIM to open whatever file it thinks is the global settings file using the menus (Edit -> Startup Settings).

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 »

And you can try :vers to see which options your VIM was compiled with, which includes the locations of the startup files.

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 »

Azhrei wrote:Oh no, I'm sure there are at least ... oh, 6 or 7 people that use (and like) VI! :mrgreen:
Heh. I use VI all the time. Its still the best coding editor out there. I just wish there were a way to bring up that editor directly from the macro editor. :?
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
syntruth
Giant
Posts: 241
Joined: Mon Aug 18, 2008 7:15 pm
Location: Michigan, USA

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by syntruth »

RPTroll wrote:
Azhrei wrote:Oh no, I'm sure there are at least ... oh, 6 or 7 people that use (and like) VI! :mrgreen:
Heh. I use VI all the time. Its still the best coding editor out there. I just wish there were a way to bring up that editor directly from the macro editor. :?
Vim has been growing on me. Being neck-deep in several ruby on rails projects lately, I used to do all my coding in *cough* nano, but the syntax highlighting was limited to the 16 standard ansi console colors. I moved to Vim due to the wonderful 256 term colors and the TextMate/Ruby On Rails colorscheme put together by my friend for vim. Since then, I am -really- starting to appreciate the power of vim, even if I still charge it with being cryptic as all get out. >.> I've never been one to fan the flames of the emacs vs. vi holy war (use what you will, darnit, and be happy!) but I am personally starting to like vi and still do not want to touch emacs ever again.

I'm -sure- there has to be a java-based vi[m] implementation somewhere. >.>

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 »

Looks like this may be more for NetBeans but the gurus here might be able to figure it out.

http://jvi.sourceforge.net/
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

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 »

syntruth wrote:Vim has been growing on me. [...]
You should get that looked at. It could be fatal.
[...] Since then, I am -really- starting to appreciate the power of vim, even if I still charge it with being cryptic as all get out.
The biggest issue I find with how people learn vi/vim is the learning process itself. Often a new user is given a cheatsheet and told, "Here -- memorize this." As though memorization was a good way to learn something! (Shades of chemistry and the Periodic Table...)

I put together a cheatsheet that I use in my Unix courses where I break down all of the vi commands into two columns: operators and operands. Then all of the vi commands are, "take one from column A and one from column B." Operators are things like delete, insert, change, replace, and so on. They specify the action to perform. Operators are the hjkl keys, the string search function, and anything else that moves the cursor. They specify how much text the action should be manipulating.

You can find my cheatsheet here by scrolling down towards the bottom of the list.

There are a few commands that don't follow the columnA/columnB paradigm, mostly as shortcuts. Things like "dd" to delete one line or "." to re-execute the previous change. The primary offenders in that regard are summarized on the cheatsheet as well, but there are others (built-in macros like "A", "D", and "ZZ" are good examples).

Apparently a lot of people like that cheatsheet since it now appears in the first 5-10 hits on Google when searching for "vi cheatsheet". :)

User avatar
hyperactiveChipmunk
Cave Troll
Posts: 99
Joined: Wed Apr 15, 2009 8:19 pm

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by hyperactiveChipmunk »

Azhrei wrote:
syntruth wrote:Vim has been growing on me. [...]
You should get that looked at. It could be fatal.
Not if you treat it well.

*feeds his vim growth some emacs macros*

Mmm, nom nom...

-hC

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 found some bugs in the syntax highlighting of Craig's work. (Sorry, Craig!)

If you search for beCountFull in the syntax/mtmacro.vim file, the first hit begins a series of 8 lines with regular expressions that define the names of the various roll options (count, foreach, etc). This is line 154 in my file, but I've made some other edits to it.

Unfortunately, they REs are not restrictive enough; each of the patterns that appear after the start= should have "\<" at the beginning. That means that each of them should change from

start=/\c
... to ...
start=/\<\c

Without the \< they will match even if there is not a word boundary immediately preceding them. That means the highlighting doesn't work when the json.fromList() macro is used, for example, because of the t(.

This still isn't a proper solution because it should only be recognized prior to the first colon, if there is one. But that means adding another state to the highlighting finite state machine and I'm not willing to figure out how the current one works enough to make that change. :)

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

Re: MapTool Macros Vim Syntax Hilight/Completion/Doc

Post by peterb »

Hi,

I'm trying to download the syntax plugin from the link in the OP, but it's not there anymore. Are there anywhere else I can get hold of it?

Thanks,

Peter

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 »

peterb wrote:Hi,

I'm trying to download the syntax plugin from the link in the OP, but it's not there anymore. Are there anywhere else I can get hold of it?

Thanks,

Peter
Attachments
mtmacro.zip
Zipped VBA file
(44.12 KiB) Downloaded 152 times

Post Reply

Return to “Drop-In Macro Resources”