Add support for :winpos
[MacVim.git] / src / testdir / test45.in
blob1dfad5454fc4e7cbec72614f978219c8a4774f61
1 Tests for folding. vim: set ft=vim :
3 STARTTEST
4 :so small.vim
5 :" We also need the +syntax feature here.
6 :if !has("syntax")
7    e! test.ok
8    w! test.out
9    qa!
10 :endif
11 :" basic test if a fold can be created, opened, moving to the end and closed
12 /^1
13 zf2j:call append("$", "manual " . getline(foldclosed(".")))
14 zo:call append("$", foldclosed("."))
15 ]z:call append("$", getline("."))
16 zc:call append("$", getline(foldclosed(".")))
17 :" test folding with markers.
18 :set fdm=marker fdl=1 fdc=3
19 /^5
20 :call append("$", "marker " . foldlevel("."))
21 [z:call append("$", foldlevel("."))
22 jo{{ \er{jj:call append("$", foldlevel("."))
23 kYpj:call append("$", foldlevel("."))
24 :" test folding with indent
25 :set fdm=indent sw=2
26 /^2 b
27 i  \ejI    \e:call append("$", "indent " . foldlevel("."))
28 k:call append("$", foldlevel("."))
29 :" test syntax folding
30 :set fdm=syntax fdl=0
31 :syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3
32 :syn region Fd1 start="ee" end="ff" fold contained
33 :syn region Fd2 start="gg" end="hh" fold contained
34 :syn region Fd3 start="commentstart" end="commentend" fold contained
35 Gzk:call append("$", "folding " . getline("."))
36 k:call append("$", getline("."))
37 jAcommentstart  \eAcommentend\e:set fdl=1
38 3j:call append("$", getline("."))
39 :" test expression folding
40 :fun Flvl()
41   let l = getline(v:lnum)
42   if l =~ "bb$"
43     return 2
44   elseif l =~ "gg$"
45     return "s1"
46   elseif l =~ "ii$"
47     return ">2"
48   elseif l =~ "kk$"
49     return "0"
50   endif
51   return "="
52 endfun
53 :set fdm=expr fde=Flvl()
54 /bb$
55 :call append("$", "expr " . foldlevel("."))
56 /hh$
57 :call append("$", foldlevel("."))
58 /ii$
59 :call append("$", foldlevel("."))
60 /kk$
61 :call append("$", foldlevel("."))
62 :/^last/+1,$w! test.out
63 :delfun Flvl
64 :qa!
65 ENDTEST
67 1 aa
68 2 bb
69 3 cc
70 4 dd {{{
71 5 ee {{{ }}}
72 6 ff }}}
73 7 gg
74 8 hh
75 9 ii
76 a jj
77 b kk
78 last