Bram Moolenaar | 6e7c7f3 | 2005-08-24 22:16:11 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: eRuby |
| 3 | " Maintainer: Doug Kearns <djkea2 at gus.gscit.monash.edu.au> |
| 4 | " Info: $Id$ |
| 5 | " URL: http://vim-ruby.sourceforge.net |
| 6 | " Anon CVS: See above site |
| 7 | " Licence: GPL (http://www.gnu.org) |
| 8 | " Disclaimer: |
| 9 | " This program is distributed in the hope that it will be useful, |
| 10 | " but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | " GNU General Public License for more details. |
| 13 | " ---------------------------------------------------------------------------- |
| 14 | |
| 15 | " For version 5.x: Clear all syntax items |
| 16 | " For version 6.x: Quit when a syntax file was already loaded |
| 17 | if version < 600 |
| 18 | syntax clear |
| 19 | elseif exists("b:current_syntax") |
| 20 | finish |
| 21 | endif |
| 22 | |
| 23 | if !exists("main_syntax") |
| 24 | let main_syntax = 'eruby' |
| 25 | endif |
| 26 | |
| 27 | if version < 600 |
| 28 | so <sfile>:p:h/html.vim |
| 29 | syn include @rubyTop <sfile>:p:h/ruby.vim |
| 30 | else |
| 31 | runtime! syntax/html.vim |
| 32 | unlet b:current_syntax |
| 33 | syn include @rubyTop syntax/ruby.vim |
| 34 | endif |
| 35 | |
| 36 | syn region erubyOneLiner matchgroup=erubyDelimiter start="^\s*\zs%" end="$" contains=@rubyTop,erubyDelimiter keepend |
| 37 | syn region erubyBlock matchgroup=erubyDelimiter start="<%=\=" end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment keepend |
| 38 | syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" keepend |
| 39 | |
| 40 | " Define the default highlighting. |
| 41 | " For version 5.7 and earlier: only when not done already |
| 42 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 43 | if version >= 508 || !exists("did_eruby_syntax_inits") |
| 44 | if version < 508 |
| 45 | let did_ruby_syntax_inits = 1 |
| 46 | command -nargs=+ HiLink hi link <args> |
| 47 | else |
| 48 | command -nargs=+ HiLink hi def link <args> |
| 49 | endif |
| 50 | |
| 51 | HiLink erubyDelimiter Delimiter |
| 52 | HiLink erubyComment Comment |
| 53 | |
| 54 | delcommand HiLink |
| 55 | endif |
| 56 | let b:current_syntax = "eruby" |
| 57 | |
| 58 | if main_syntax == 'eruby' |
| 59 | unlet main_syntax |
| 60 | endif |
| 61 | |
| 62 | " vim: sw=2 sts=2 ts=8 ff=unix nowrap: |