Tests for autocommands:
- FileWritePre		writing a compressed file
- FileReadPost		reading a compressed file
- BufNewFile		reading a file template
- BufReadPre		decompressing the file to be read
- FilterReadPre		substituting characters in the temp file
- FilterReadPost	substituting characters after filtering
- FileReadPre		set options for decompression
- FileReadPost		decompress the file

STARTTEST
:set bin
:au FileWritePre    *.gz   '[,']!gzip
:au FileWritePost   *.gz   undo
:/start of testfile/,/end of testfile/w! Xtestfile.gz
:au FileReadPost    *.gz   '[,']!gunzip
:$r Xtestfile.gz                " Read and decompress the testfile
:?startstart?,$w! test.out      " Write contents of this file
:au BufNewFile      *.c    read Xtest.c
gg/^end of testfile
:/start of test.c/+1,/end of test.c/-1w! Xtest.c
:e! foo.c                       " Will load test.c
:au FileAppendPre   *.out  '[,']s/new/NEW/
:au FileAppendPost  *.out  !echo hello there >>test.out
:w>>test.out                    " Append it to the output file
:au! FileAppendPre
:" setup autocommands to decompress before reading and re-compress afterwards
:au BufReadPre      *.gz   !gunzip <afile>
:au BufReadPre      *.gz   !mv <afile>:r <afile>
:au BufReadPost     *.gz   !mv <afile> <afile>:r
:au BufReadPost     *.gz   !gzip <afile>:r
:e! Xtestfile.gz                " Edit compressed file
:w>>test.out                    " Append it to the output file
:au FilterReadPre   *.out  !mv <afile> <afile>.t
:au FilterReadPre   *.out  !sed s/e/E/ <afile>.t ><afile>
:au FilterReadPre   *.out  !rm <afile>.t
:au FilterReadPost  *.out  '[,']s/x/X/g
:e! test.out                    " Edit the output file
:23,$!cat
:au! FileReadPre    *.gz   !gunzip <afile>
:au  FileReadPre    *.gz   !mv <afile>:r <afile>
:au! FileReadPost   *.gz   '[,']s/l/L/
:$r Xtestfile.gz             " Read compressed file
:w                           " write it, after filtering
:!rm Xtestfile.gz Xtest.c
:qa!
ENDTEST

startstart
start of testfile
line 2	Abcdefghijklmnopqrstuvwxyz
line 3	xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
line 4	Abcdefghijklmnopqrstuvwxyz
line 5	xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
line 6	Abcdefghijklmnopqrstuvwxyz
line 7	xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
line 8	Abcdefghijklmnopqrstuvwxyz
line 9	xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
line 10 Abcdefghijklmnopqrstuvwxyz
end of testfile

start of test.c
/*
 * Here is a new .c file
 */
end of test.c
