Added Subversion post-commit script for vim.
[profile.git] / .vim / script / svn
1 " $Id$
2 " Define the function we'll use.  It's easier to do this than to faff about 
3 " trying to run a sequence of normal mode commands.
4 fun! SVNcommit()
5   " Allow closing an unmodified spec.
6   set nomod
7
8   " Create a new window, move it below the spec and read in a diff.
9   botright new
10   r!svn diff
11   setf diff
12
13   " Delete the blank line left above the diff.
14   1
15   delete
16   se nobuflisted
17   set buftype=nofile
18   set bufhidden=hide
19   setlocal noswapfile
20
21   " Switch back to the top window.
22   wincmd k
23 endfun
24
25 " Expand the command line window so we don't have to press RETURN later.
26 let s:cmdheight = &cmdheight
27 se cmdheight=2
28
29 " Call and then discard our function.
30 call SVNcommit()
31 delfunction SVNcommit
32
33 " Restore the command window.
34 exe "se cmdheight=" . s:cmdheight
35
36 " Close the scratch buffer.
37 au BufWinLeave <buffer=1> qa!