Narrow diffs to the modified files.
[profile.git] / .vim / script / svn
1 " $Id$ vim: se syntax=vim:
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   " Get the modified files.
9   let l:files = system("sed '1,/^$/d;s/^[MR]....//' " . bufname(""))
10
11   " Create a new window, move it below the spec and read in a diff.
12   botright new
13   exe "r!svn diff " . substitute(l:files, "\n", " ", "g")
14   setf diff
15
16   " Delete the blank line left above the diff.
17   1
18   delete
19   se nobuflisted
20   set buftype=nowrite
21   set bufhidden=hide
22   setlocal noswapfile
23   file [svn diff]
24
25   " Switch back to the top window.
26   wincmd k
27 endfun
28
29 " Expand the command line window so we don't have to press RETURN later.
30 let s:cmdheight = &cmdheight
31 se cmdheight=3
32
33 " Call and then discard our function.
34 call SVNcommit()
35 delfunction SVNcommit
36
37 " Restore the command window.
38 exe "se cmdheight=" . s:cmdheight
39
40 " Close the scratch buffer.
41 au BufWinLeave <buffer=1> qa!