| 1 |
" Vim syntax file |
| 2 |
" Language: Mercurial unified tests |
| 3 |
" Author: Steve Losh ([email protected]) |
| 4 |
" |
| 5 |
" Place this file in ~/.vim/syntax/ and add the following line to your |
| 6 |
" ~/.vimrc to enable: |
| 7 |
" au BufNewFile,BufRead *.t set filetype=hgtest |
| 8 |
" |
| 9 |
" If you want folding you'll need the following line as well: |
| 10 |
" let hgtest_fold=1 |
| 11 |
" |
| 12 |
" You might also want to set the starting foldlevel for hgtest files: |
| 13 |
" autocmd Syntax hgtest setlocal foldlevel=1 |
| 14 |
|
| 15 |
if exists("b:current_syntax") |
| 16 |
finish |
| 17 |
endif |
| 18 |
|
| 19 |
syn include @Shell syntax/sh.vim |
| 20 |
|
| 21 |
syn match hgtestComment /^[^ ].*$/ |
| 22 |
syn region hgtestOutput start=/^ [^$>]/ start=/^ $/ end=/\v.(\n\n*[^ ])\@=/me=s end=/^ [$>]/me=e-3 end=/^$/ fold containedin=hgtestBlock |
| 23 |
syn match hgtestCommandStart /^ \$ / containedin=hgtestCommand |
| 24 |
syn region hgtestCommand start=/^ \$ /hs=s+4,rs=s+4 end=/^ [^>]/me=e-3 end=/^ $/me=e-2 containedin=hgtestBlock contains=@Shell keepend |
| 25 |
syn region hgtestBlock start=/^ /ms=e-2 end=/\v.(\n\n*[^ ])\@=/me=s end=/^$/me=e-1 fold keepend |
| 26 |
|
| 27 |
hi link hgtestCommandStart Keyword |
| 28 |
hi link hgtestComment Normal |
| 29 |
hi link hgtestOutput Comment |
| 30 |
|
| 31 |
if exists("hgtest_fold") |
| 32 |
setlocal foldmethod=syntax |
| 33 |
endif |
| 34 |
|
| 35 |
syn sync match hgtestSync grouphere NONE "^$" |
| 36 |
syn sync maxlines=200 |
| 37 |
|
| 38 |
" It's okay to set tab settings here, because an indent of two spaces is specified |
| 39 |
" by the file format. |
| 40 |
setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab |
| 41 |
|
| 42 |
let b:current_syntax = "hgtest" |