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