1 "Copyright 2007 Alex Norman
3 "This file is part of SCVIM.
5 "SCVIM is free software: you can redistribute it and/or modify
6 "it under the terms of the GNU General Public License as published by
7 "the Free Software Foundation, either version 3 of the License, or
8 "(at your option) any later version.
10 "SCVIM is distributed in the hope that it will be useful,
11 "but WITHOUT ANY WARRANTY; without even the implied warranty of
12 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 "GNU General Public License for more details.
15 "You should have received a copy of the GNU General Public License
16 "along with SCVIM. If not, see <http://www.gnu.org/licenses/>.
19 " Language: supercollider
20 " Maintainer: alex norman <alex@x37v.info>
22 " Last change: 2007-11-21
26 syn match scAoperator "{"
27 syn match scAoperator "}"
29 "syn match scVariable "\%(var.*\)\@<=\(\l\w*\)" "lowercase followed by wordchar
30 syn match scGlobvariable "\~\l\w*" "~ followed by lowercase followed by wordchar
31 syn match scVar "\s*var\s"
32 syn match scVar "\s*classvar\s"
33 syn match scArg "\s*arg\s"
35 " symbols, strings, etc
36 "syn match scSymbol "\(\w\\\)\@<!\'.\{-}\'" "\{-} is a non greedy version of *
37 "syn match scSymbol "\(\w\|\\\)\@<!\'.\{-}\(\\\)\@<!\'" "\{-} is a non greedy version of *
39 syn match scSymbol "\v(\w|\\)@<!\'.{-}(\\)@<!\'" "\{-} is a non greedy version of *
41 "syn match scSymbol "\$\@<!\\\w\w*"
42 syn match scSymbol "\v\$@<!\\\w\w*"
43 syn match scSymbol "\\\\"
45 syn match scChar "\$\w"
46 syn match scChar "\$\\\\"
47 syn match scChar "\$\\\w"
49 "syn match scString "\".\{-}\""
50 "syn region scString start=+\v\\@<!"+ end=+\v\\@<!"+
51 syn region scString start=+"+ skip=+\\\\\|\\"+ end=+"+
53 "syn match scClass "\u\w*" "upper case followed by any wordchar
55 syn keyword scSpecialval nil true false inf this
57 "syn keyword repeat do for while
59 "syn region literalarray start="\#\[" end="\]"
60 "need to figure out how to make it match the mattching braket
62 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
65 "syn match scFun "\.\@<=\a\w*"
67 syn match scArate "\v\.@<=ar(\w)@!"
68 syn match scKrate "\v\.@<=kr(\w)@!"
70 " load list of all objects
71 if filereadable($SCVIM_CACHE_DIR . "/supercollider_objects.vim")
72 source $SCVIM_CACHE_DIR/supercollider_objects.vim
73 elseif filereadable($HOME . ".scvim/supercollider_objects.vim")
74 source $HOME/.scvim/supercollider_objects.vim
76 " load all the language stuff
77 runtime! syntax/supercollider_lang.vim
78 runtime! syntax/supercollider_operators.vim
81 syn match scComment "//.*$"
82 syn region scComment start="/\*" end="\*/" contains=scComment keepend extend
87 "hi link scFun Function
89 "hi link scUgen Function
90 "hi link scLang Function
92 "hi link scBinaryoperator Operator
93 "hi link scUnaryoperator Operator
95 "hi link scAoperator Delimiter
96 "hi link scArate Delimiter
97 "hi link scKrate Delimiter
99 "hi link scSymbol String
101 "hi link scString String
103 "hi link scSpecialval Special
105 ""hi link scRepeat Repeat
107 ""hi link scVariable String
108 "hi link scGlobVariable Statement
110 "hi link scComment Comment
112 "hi link scVar Question
113 "hi link scArg Question
115 "Here I have defined my own syntax colors
116 "you can customize these however you like
118 "hi scObject term=bold ctermfg=cyan guifg=cyan
119 "hi scLang term=bold ctermfg=lightcyan guifg=lightcyan
121 "hi scBinaryoperator term=bold ctermfg=brown guifg=brown
122 "hi scUnaryoperator term=bold ctermfg=brown guifg=brown
124 "hi scAoperator term=bold ctermfg=darkyellow guifg=darkyellow
125 "hi scArate term=bold ctermfg=darkyellow guifg=darkyellow
126 "hi scKrate term=bold ctermfg=darkyellow guifg=darkyellow
128 "hi scSymbol term=bold ctermfg=red guifg=red
130 "hi scString term=bold ctermfg=darkred guifg=darkred
132 "hi scChar term=bold ctermfg=lightred guifg=lightred
134 "hi scSpecialval term=bold ctermfg=magenta guifg=magenta
136 "hi scGlobVariable term=bold ctermfg=yellow guifg=yellow
138 "hi scComment term=bold ctermfg=darkblue guifg=darkblue
140 "hi scVar term=bold ctermfg=green guifg=green
141 "hi scArg term=bold ctermfg=green guifg=green
144 hi link scObject Identifier
145 hi link scLang Identifier
147 hi link scBinaryoperator Special
148 hi link scUnaryoperator Special
150 hi link scAoperator Statement
151 hi link scArate Statement
152 hi link scKrate Statement
154 hi link scSymbol String
156 hi link scString String
158 hi link scChar String
160 hi link scSpecialval Constant
162 hi link scGlobVariable Define
164 hi link scComment Comment
169 let b:current_syntax = "supercollider"