Debian Codegraph @

contrib/cram.vim

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