1Test for BufWritePre autocommand that deletes or unloads the buffer.
2
3STARTTEST
4:so small.vim
5:au BufWritePre Xxx1 bunload
6:au BufWritePre Xxx2 bwipe
7/^start of
8A1:.,/end of/w! Xxx1  " write test file Xxx1
9$r2:.,/end of/w! Xxx2   " write test file Xxx2
10:e! Xxx2                " edit Xxx2
11:bdel test8.in		" delete this file from the buffer list
12:e Xxx1                 " edit Xxx1
13:w                      " write it, will unload it and give an error msg
14:w! test.out            " Write contents of this file
15:e! Xxx2                " start editing Xxx2
16:bwipe test.out         " remove test.out from the buffer list
17:w                      " write it, will delete the buffer and give an error msg
18:w >>test.out           " Append contents of this file
19:qa!
20ENDTEST
21
22start of Xxx
23	test
24end of Xxx
25