Mercurial > vim
annotate src/testdir/test11.in @ 3429:b35844f3eb49 v7.3.480
updated for version 7.3.480
Problem: When using ":qa" and there is a changed buffer picking the buffer
to jump to is not very good.
Solution: Consider current and other tab pages. (Hirohito Higashi)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 23 Mar 2012 18:39:18 +0100 |
parents | 82193fef6172 |
children | 9d5b8b015e5f |
rev | line source |
---|---|
7 | 1 Tests for autocommands: |
2 - FileWritePre writing a compressed file | |
3 - FileReadPost reading a compressed file | |
4 - BufNewFile reading a file template | |
5 - BufReadPre decompressing the file to be read | |
6 - FilterReadPre substituting characters in the temp file | |
7 - FilterReadPost substituting characters after filtering | |
8 - FileReadPre set options for decompression | |
9 - FileReadPost decompress the file | |
10 | |
2516
82193fef6172
Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents:
1624
diff
changeset
|
11 Note: This test is skipped if "gzip" is not available. |
7 | 12 $GZIP is made empty, "-v" would cause trouble. |
13 Use a FileChangedShell autocommand to avoid a prompt for "Xtestfile.gz" being | |
14 modified outside of Vim (noticed on Solaris). | |
15 | |
16 STARTTEST | |
17 :so small.vim | |
2516
82193fef6172
Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents:
1624
diff
changeset
|
18 :" drop out when there is no gzip program |
82193fef6172
Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents:
1624
diff
changeset
|
19 :if !executable("gzip") |
82193fef6172
Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents:
1624
diff
changeset
|
20 : e! test.ok |
82193fef6172
Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents:
1624
diff
changeset
|
21 : w! test.out |
82193fef6172
Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents:
1624
diff
changeset
|
22 : qa! |
82193fef6172
Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents:
1624
diff
changeset
|
23 :endif |
7 | 24 :let $GZIP = "" |
25 :au FileChangedShell * echo "caught FileChangedShell" | |
26 :set bin | |
27 :au FileWritePre *.gz '[,']!gzip | |
28 :au FileWritePost *.gz undo | |
18 | 29 :/^start of testfile/,/^end of testfile/w! Xtestfile.gz |
7 | 30 :au FileReadPost *.gz '[,']!gzip -d |
31 :$r Xtestfile.gz " Read and decompress the testfile | |
32 :?startstart?,$w! test.out " Write contents of this file | |
33 :au BufNewFile *.c read Xtest.c | |
18 | 34 :/^start of test.c/+1,/^end of test.c/-1w! Xtest.c |
7 | 35 :e! foo.c " Will load Xtest.c |
36 :au FileAppendPre *.out '[,']s/new/NEW/ | |
37 :au FileAppendPost *.out !cat Xtest.c >>test.out | |
38 :w>>test.out " Append it to the output file | |
39 :au! FileAppendPre | |
40 :" setup autocommands to decompress before reading and re-compress afterwards | |
1624 | 41 :au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand("<afile>")) |
7 | 42 :au BufReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>")) |
43 :au BufReadPost *.gz call rename(expand("<afile>"), expand("<afile>:r")) | |
1624 | 44 :au BufReadPost *.gz exe '!gzip ' . shellescape(expand("<afile>:r")) |
7 | 45 :e! Xtestfile.gz " Edit compressed file |
46 :w>>test.out " Append it to the output file | |
167 | 47 :set shelltemp " need temp files here |
1624 | 48 :au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t") |
49 :au FilterReadPre *.out exe '!sed s/e/E/ ' . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>")) | |
50 :au FilterReadPre *.out exe '!rm ' . shellescape(expand("<afile>")) . '.t' | |
7 | 51 :au FilterReadPost *.out '[,']s/x/X/g |
52 :e! test.out " Edit the output file | |
53 :23,$!cat | |
63 | 54 :23,$s/\r$// " remove CR for when sed adds them |
1624 | 55 :au! FileReadPre *.gz exe '!gzip -d ' . shellescape(expand("<afile>")) |
7 | 56 :au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>")) |
57 :au! FileReadPost *.gz '[,']s/l/L/ | |
58 :$r Xtestfile.gz " Read compressed file | |
59 :w " write it, after filtering | |
60 :au! " remove all autocommands | |
61 :e " Edit test.out again | |
62 :set nobin ff& " use the default fileformat for writing | |
63 :w | |
64 :qa! | |
65 ENDTEST | |
66 | |
67 startstart | |
68 start of testfile | |
69 line 2 Abcdefghijklmnopqrstuvwxyz | |
70 line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
71 line 4 Abcdefghijklmnopqrstuvwxyz | |
72 line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
73 line 6 Abcdefghijklmnopqrstuvwxyz | |
74 line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
75 line 8 Abcdefghijklmnopqrstuvwxyz | |
76 line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
77 line 10 Abcdefghijklmnopqrstuvwxyz | |
78 end of testfile | |
79 | |
80 start of test.c | |
81 /* | |
82 * Here is a new .c file | |
83 */ | |
84 end of test.c |