TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Set up vim highlighting syntax for tt++

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
goofy



Joined: 24 Mar 2008
Posts: 164

PostPosted: Sun Jan 24, 2016 10:27 pm    Post subject: Set up vim highlighting syntax for tt++ Reply with quote

This is aimed at (novice) Debian users,
it may work for other linux distros though.

Debian doesn't have full vim installed by default, so...
open root terminal and enter the command below

aptitude install vim

next copy and paste the following text into the associated files.
(create them if they are not present)

~/.vim/ftdetect/tt.vim
Code:
au BufNewFile,BufRead *.tt,*.tin set ft=tt


~/.vimrc
Code:
"Set tab to insert 4 spaces
set ts=4

"set to show highlight syntax
syntax on


~/.vim/syntax/tt.vim
Code:
"Created by Svakanda for tt++ January 2008
"    cheshire.in.darkness@gmail.com
"anything behind these double quotes are COMMENTS.  This is a Comment.

"sets the '#' character as a valid keyword character
setlocal iskeyword+=#

"defines valid keywords the '[]'s in #ac[tion] designates autofill, and so on.
syntax keyword ttCommands #alias #ac[tion] #all #bell #buffer #chat #class #colors #config #cr #credits
syntax keyword ttCommands #cursor #delay #echo #end #gag #gagline #help #high[light] #history #if #ig[nore]
syntax keyword ttCommands #debug #escape #forall #format #fu[nction] #grep #history #info #kill #list
syntax keyword ttCommands #loadpath #log #logline #loop #macro #map #mark #math #message #nop
syntax keyword ttCommands #parse #path #pathdir #prompt #read #rep[lacestring] #savepath #return #scan
syntax keyword ttCommands #send #session #showme #snoop #spe[edwalk] #split #sub[stitute] #suspend #system
syntax keyword ttCommands #tab #textin #ti[ck] #unaction #unalias #unclass #unfunction #ungag #unhighlight
syntax keyword ttCommands #unmacro #unpath #unprompt #unsplit #unsubstitute #untab #untick #unvariable
syntax keyword ttCommands #var[iable] #walk #write #zap

"ttNum is one color group
syntax match ttNum /\d*/ "matches plain numbers

"ttMacros group is one color group
syntax match ttMacros /<\d\d\d>/ "matches color codes such as <030>
syntax match ttMacros /%\d/ "matches dynamic arguments like %0 %1 etc...
syntax match ttMacros /&\d/ "matches list indexes like &0 and &1

"ttIdentifier is one color group
syntax match ttIdentifier /\<\a\+\>/ "matches any string of capital or lowercase letters

syntax match ttVar /\$\%[{]\a*/ "matches variables that are going to be expanded / preceded by the '$' symbol
syntax match ttVar /;/ "matches command separator ';'

"matchgroup just colors the delimiters '{' and '}'. the contains=ALLBUT is
"means that this region is completely recursive upon itself, and filters down
"to as many inner-regions as you need...in addition it allows
"definitions/matches of all other groups besides ttIdentifier.
"
"The ttVarBlock region is used to color variables expressed within
"braces...such as ${charHp}
syntax region ttBlock matchgroup=ttBraces start=/{/ skip=/$/ end=/}/ contains=ALLBUT,ttIdentifier
syntax region ttVarBlock matchgroup=ttVarBraces start=/${/ end=/}/ contained

"all prior syntax commands just divide different areas into groups, in order
"to actually apply color you need to link the groups (everything that starts
"with two lowercase t's..such as ttBlock and ttMacros) link the groups to
"color...in order to provide user modularity, vim as special groups already
"assigned colors, you can view a list of these groups with the vim command
"-> :help group-name <- 
"The presents I am using below are Number, Special, Statement, Identifier,
"PreProc, and Structure...vim then binds these Groups to color statements...so
"if you want to change the colors, you need to change your vim user settings
"to modify the color of these groups.
"
highlight link ttNum Number

highlight link ttVar Special
highlight link ttVarBraces Special
highlight link ttVarBlock Special

highlight link ttCommands Statement
highlight link ttBraces Statement

highlight link ttIdentifier Identifier

highlight link ttMacros PreProc

highlight link ttBlock Structure

let b:current_syntax = "tt"

_________________
www.abandonedrealms.com
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Tue Feb 23, 2016 3:29 pm    Post subject: Reply with quote

This is a little improvement, that I made some time ago, of the syntax, it contains some commands that weren't recognised from the original one, and also some abbreviations of them

Code:

"defines valid keywords the '[]'s in #ac[tion] designates autofill, and so on.
syntax keyword ttCommands #alias #ac[tion] #all #bell #buffer #chat #class #colors #config #cr #credits
syntax keyword ttCommands #cursor #delay #echo #end #gag #gagline #help #high[light] #history #if #ig[nore]
syntax keyword ttCommands #debug #escape #forall #format #fu[nction] #grep #history #info #kill #list
syntax keyword ttCommands #loadpath #log #logline #loop #macro #map #mark #math #message #nop
syntax keyword ttCommands #parse #path #pathdir #prompt #read #rep[lacestring] #savepath #return #scan
syntax keyword ttCommands #send #session #showme #snoop #spe[edwalk] #split #sub[stitute] #suspend #system
syntax keyword ttCommands #tab #textin #ti[ck] #unaction #unalias #unclass #unfunction #ungag #unhighlight
syntax keyword ttCommands #unmacro #unpath #unprompt #unsplit #unsubstitute #untab #untick #unvar[iable]
syntax keyword ttCommands #var[iable] #walk #write #zap
syntax keyword ttCommands #unde[lay] #ev[ent] #unev[ent]


there's anyway a lot that could be improved, maybe this thread could become an aggregator for "patches" to make the syntax perfect Wink
Back to top
View user's profile Send private message
LokiChaos



Joined: 27 Oct 2009
Posts: 61

PostPosted: Mon Apr 18, 2016 3:54 pm    Post subject: Reply with quote

https://github.com/LokiChaos/vim-tintin

It's not perfect, but it does a pretty good job.
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Wed Apr 20, 2016 5:11 am    Post subject: Reply with quote

Cool, I'll have a look at it Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group