1 Inserts 10000 lines with text to fill the swap file with two levels of pointer
2 blocks. Then recovers from the swap file and checks all text is restored.
4 We need about 10000 lines of 100 characters to get two levels of pointer
9 :set nocp fileformat=unix undolevels=-1 viminfo+=nviminfo
12 :let text = "\tabcdefghijklmnoparstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnoparstuvwxyz0123456789"
14 :let linecount = 10000
15 :while i <= linecount | call append(i - 1, i . text) | let i += 1 | endwhile
17 :" get the name of the swap file
21 :let swapname = substitute(swapname, '[[:blank:][:cntrl:]]*\(.\{-}\)[[:blank:][:cntrl:]]*$', '\1', '')
22 :" make a copy of the swap file in Xswap
31 :call rename('Xswap', swapname)
33 :call delete(swapname)
35 :call append(0, 'recovery start')
37 :let linedollar = line('$')
38 :if linedollar < linecount | exe 'wincmd w' | call append(line('$'), "expected " . linecount . " lines but found only " . linedollar) | exe 'wincmd w' | let linecount = linedollar | endif
40 :while i <= linecount | if getline(i) != i . text | exe 'wincmd w' | call append(line('$'), i . ' differs') | exe 'wincmd w' | endif | let i += 1 | endwhile
42 :call append(line('$'), 'recovery end')