1 " Define the function we'll use. It's easier to do this than to faff about
2 " trying to run a sequence of normal mode commands.
4 " There's no point doing this if the spec is readonly. That probably means
5 " it's a submitted change.
7 " Clear the unnamed register.
10 " Delete the spec blurb if it exists.
11 /^# A Perforce Change Spec/,/^$/d
12 " If the blurb was deleted the text will be in the unnamed register.
14 " Allow closing an unmodified spec.
17 " Create a new window, move it below the spec and read in a diff.
22 " Delete the blank line left above the diff.
30 " Switch back to the top window and put the cursor by the description.
34 ?<enter description here>
38 " We get here if no blurb was deleted. This is the case if we aren't
44 " Expand the command line window so we don't have to press RETURN later.
45 let s:cmdheight = &cmdheight
48 " Call and then discard our function.
51 " Don't expand tabs in the spec.
54 " Restore the command window.
55 exe "set cmdheight=" . s:cmdheight
57 " Close the scratch buffer.
58 au BufWinLeave <buffer=1> qa!