Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Quake[1-3] Configuration File |
| 3 | " Maintainer: Nikolai Weibull <source@pcppopper.org> |
| 4 | " URL: http://www.pcppopper.org/vim/syntax/pcp/quake/ |
| 5 | " Latest Revision: 2004-05-22 |
| 6 | " arch-tag: a95793d7-cab3-4544-a78c-1cea47b5870b |
| 7 | " Variables: quake_is_quake1 - the syntax is to be used for quake1 configs |
| 8 | " quake_is_quake2 - the syntax is to be used for quake2 configs |
| 9 | " quake_is_quake3 - the syntax is to be used for quake3 configs |
| 10 | |
| 11 | |
| 12 | if version < 600 |
| 13 | syntax clear |
| 14 | elseif exists("b:current_syntax") |
| 15 | finish |
| 16 | endif |
| 17 | |
| 18 | |
| 19 | " Set iskeyword since we need `-' (and potentially others) in keywords. |
| 20 | " For version 5.x: Set it globally |
| 21 | " For version 6.x: Set it locally |
| 22 | if version >= 600 |
| 23 | command -nargs=1 SetIsk setlocal iskeyword=<args> |
| 24 | else |
| 25 | command -nargs=1 SetIsk set iskeyword=<args> |
| 26 | endif |
| 27 | SetIsk 48-57,65-90,97-122,+,-,_ |
| 28 | delcommand SetIsk |
| 29 | |
| 30 | |
| 31 | " comments |
| 32 | syn region quakeComment display oneline start="//" end="$" end=";" keepend contains=quakeTodo |
| 33 | |
| 34 | " todo |
| 35 | syn keyword quakeTodo contained TODO FIXME XXX NOTE |
| 36 | |
| 37 | " string (can contain numbers (which should be hilighted as such) |
| 38 | syn region quakeString display oneline start=+"+ skip=+\\"+ end=+"\|$+ contains=quakeNumbers,@quakeCommands |
| 39 | |
| 40 | " number |
| 41 | syn case ignore |
| 42 | syn match quakeNumbers display transparent "\<\d\|\.\d" contains=quakeNumber,quakeFloat,quakeOctalError,quakeOctal |
| 43 | syn match quakeNumber display contained "\d\+\>" |
| 44 | " Flag the first zero of an octal number as something special |
| 45 | syn match quakeOctal display contained "0\o\+\>" contains=quakeOctalZero |
| 46 | syn match quakeOctalZero display contained "\<0" |
| 47 | " floating point number, with dot |
| 48 | syn match quakeFloat display contained "\d\+\.\d*" |
| 49 | " floating point number, starting with a dot |
| 50 | syn match quakeFloat display contained "\.\d\+\>" |
| 51 | " flag an octal number with wrong digits |
| 52 | syn match quakeOctalError display contained "0\o*[89]\d*" |
| 53 | syn case match |
| 54 | |
| 55 | " commands |
| 56 | syn case ignore |
| 57 | syn cluster quakeCommands contains=quakeCommand,quake1Command,quake12Command,Quake2Command,Quake23Command,Quake3Command |
| 58 | |
| 59 | syn keyword quakeCommand +attack +back +forward +left +lookdown +lookup |
| 60 | syn keyword quakeCommand +mlook +movedown +moveleft +moveright +moveup |
| 61 | syn keyword quakeCommand +right +speed +strafe -attack -back bind |
| 62 | syn keyword quakeCommand bindlist centerview clear connect cvarlist dir |
| 63 | syn keyword quakeCommand disconnect dumpuser echo error exec -forward |
| 64 | syn keyword quakeCommand god heartbeat joy_advancedupdate kick kill |
| 65 | syn keyword quakeCommand killserver -left -lookdown -lookup map |
| 66 | syn keyword quakeCommand messagemode messagemode2 -mlook modellist |
| 67 | syn keyword quakeCommand -movedown -moveleft -moveright -moveup play |
| 68 | syn keyword quakeCommand quit rcon reconnect record -right say say_team |
| 69 | syn keyword quakeCommand screenshot serverinfo serverrecord serverstop |
| 70 | syn keyword quakeCommand set sizedown sizeup snd_restart soundinfo |
| 71 | syn keyword quakeCommand soundlist -speed spmap status -strafe stopsound |
| 72 | syn keyword quakeCommand toggleconsole unbind unbindall userinfo pause |
| 73 | syn keyword quakeCommand vid_restart viewpos wait weapnext weapprev |
| 74 | |
| 75 | if exists("quake_is_quake1") |
| 76 | syn keyword quake1Command sv |
| 77 | endif |
| 78 | |
| 79 | if exists("quake_is_quake1") || exists("quake_is_quake2") |
| 80 | syn keyword quake12Command +klook alias cd impulse link load save |
| 81 | syn keyword quake12Command timerefresh changing info loading |
| 82 | syn keyword quake12Command pingservers playerlist players score |
| 83 | endif |
| 84 | |
| 85 | if exists("quake_is_quake2") |
| 86 | syn keyword quake2Command cmd demomap +use condump download drop gamemap |
| 87 | syn keyword quake2Command give gun_model setmaster sky sv_maplist wave |
| 88 | syn keyword quake2Command cmdlist gameversiona gun_next gun_prev invdrop |
| 89 | syn keyword quake2Command inven invnext invnextp invnextw invprev |
| 90 | syn keyword quake2Command invprevp invprevw invuse menu_addressbook |
| 91 | syn keyword quake2Command menu_credits menu_dmoptions menu_game |
| 92 | syn keyword quake2Command menu_joinserver menu_keys menu_loadgame |
| 93 | syn keyword quake2Command menu_main menu_multiplayer menu_options |
| 94 | syn keyword quake2Command menu_playerconfig menu_quit menu_savegame |
| 95 | syn keyword quake2Command menu_startserver menu_video |
| 96 | syn keyword quake2Command notarget precache prog togglechat vid_front |
| 97 | syn keyword quake2Command weaplast |
| 98 | endif |
| 99 | |
| 100 | if exists("quake_is_quake2") || exists("quake_is_quake3") |
| 101 | syn keyword quake23Command imagelist modellist path z_stats |
| 102 | endif |
| 103 | |
| 104 | if exists("quake_is_quake3") |
| 105 | syn keyword quake3Command +info +scores +zoom addbot arena banClient |
| 106 | syn keyword quake3Command banUser callteamvote callvote changeVectors |
| 107 | syn keyword quake3Command cinematic clientinfo clientkick cmd cmdlist |
| 108 | syn keyword quake3Command condump configstrings crash cvar_restart devmap |
| 109 | syn keyword quake3Command fdir follow freeze fs_openedList Fs_pureList |
| 110 | syn keyword quake3Command Fs_referencedList gfxinfo globalservers |
| 111 | syn keyword quake3Command hunk_stats in_restart -info levelshot |
| 112 | syn keyword quake3Command loaddeferred localservers map_restart mem_info |
| 113 | syn keyword quake3Command messagemode3 messagemode4 midiinfo model music |
| 114 | syn keyword quake3Command modelist net_restart nextframe nextskin noclip |
| 115 | syn keyword quake3Command notarget ping prevframe prevskin reset restart |
| 116 | syn keyword quake3Command s_disable_a3d s_enable_a3d s_info s_list s_stop |
| 117 | syn keyword quake3Command scanservers -scores screenshotJPEG sectorlist |
| 118 | syn keyword quake3Command serverstatus seta setenv sets setu setviewpos |
| 119 | syn keyword quake3Command shaderlist showip skinlist spdevmap startOribt |
| 120 | syn keyword quake3Command stats stopdemo stoprecord systeminfo togglemenu |
| 121 | syn keyword quake3Command tcmd team teamtask teamvote tell tell_attacker |
| 122 | syn keyword quake3Command tell_target testgun testmodel testshader toggle |
| 123 | syn keyword quake3Command touchFile vminfo vmprofile vmtest vosay |
| 124 | syn keyword quake3Command vosay_team vote votell vsay vsay_team vstr |
| 125 | syn keyword quake3Command vtaunt vtell vtell_attacker vtell_target weapon |
| 126 | syn keyword quake3Command writeconfig -zoom |
| 127 | syn match quake3Command display "\<[+-]button\(\d\|1[0-4]\)\>" |
| 128 | endif |
| 129 | |
| 130 | syn case match |
| 131 | |
| 132 | " Define the default highlighting. |
| 133 | " For version 5.7 and earlier: only when not done already |
| 134 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 135 | if version >= 508 || !exists("did_screen_syn_inits") |
| 136 | if version < 508 |
| 137 | let did_screen_syn_inits = 1 |
| 138 | command -nargs=+ HiLink hi link <args> |
| 139 | else |
| 140 | command -nargs=+ HiLink hi def link <args> |
| 141 | endif |
| 142 | |
| 143 | HiLink quakeComment Comment |
| 144 | HiLink quakeTodo Todo |
| 145 | HiLink quakeString String |
| 146 | HiLink quakeNumber Number |
| 147 | HiLink quakeOctal Number |
| 148 | HiLink quakeOctalZero Number |
| 149 | HiLink quakeFloat Number |
| 150 | HiLink quakeOctalError Error |
| 151 | HiLink quakeCommand quakeCommands |
| 152 | HiLink quake1Command quakeCommands |
| 153 | HiLink quake12Command quakeCommands |
| 154 | HiLink quake2Command quakeCommands |
| 155 | HiLink quake23Command quakeCommands |
| 156 | HiLink quake3Command quakeCommands |
| 157 | HiLink quakeCommands Keyword |
| 158 | |
| 159 | delcommand HiLink |
| 160 | endif |
| 161 | |
| 162 | " vim: set sts=2 sw=2: |