Skip to content

Commit dd301b1

Browse files
Michael Scherervim-scripts
authored andcommitted
Version 0.4: No more TODO list, now everything i in pure vim function.
1 parent c97fbb6 commit dd301b1

1 file changed

Lines changed: 28 additions & 32 deletions

File tree

ftplugin/svn.vim

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
" made by Michael Scherer ( misc@mandrake.org )
22
" $Id: svn.vim 282 2005-01-31 21:24:55Z misc $
3-
" TODO - rewrite in pure vim functions
43
"
54
" 2004-09-13 : Lukas Ruf ( lukas.ruf@lpr.ch )
65
" - re-ordered windows
@@ -10,43 +9,40 @@
109
" 2005-01-31 :
1110
" - autoclose on exit, thanks to Gintautas Miliauskas ( gintas@akl.lt )
1211
" and tips from Marius Gedminas ( mgedmin@b4net.lt )
13-
"
14-
" to use it, place it in ~/.vim and add
15-
" au BufRead svn-commit.tmp source ~/.vim/svn.vim
16-
" to your .vimrc
17-
12+
"
13+
" 2005-02-08 :
14+
" - rewrite in pure vim function, from Kyosuke Takayama ( support@mc.neweb.ne.jp )
15+
" - simplified installation instruction, from Marius Gedminas ( mgedmin@b4net.lt )
16+
"
17+
" to use it, place it in ~/.vim/plugins ( create the directory if it doesn't exist )
1818

1919
function! Svn_diff_windows()
20-
python <<EOF
21-
import vim
22-
import re
23-
svn_re=re.compile('^--This line, and those below, will be ignored--$')
24-
modif_re=re.compile('^MM?\s*(.*)\s*$')
25-
win=vim.windows[0]
26-
svn_found=0
27-
list_of_files=''
20+
let i = 0
21+
let list_of_files = ''
2822

29-
for b in win.buffer:
30-
if svn_re.search(b):
31-
svn_found=1
32-
if not svn_found:
33-
continue
34-
35-
if modif_re.search(b):
36-
list_of_files=list_of_files+' '+modif_re.match(b).group(1)
23+
while i <= line('$')
24+
let line = getline(i)
25+
if line =~ '^M'
3726

38-
vim.command("new")
39-
win.height=len(win.buffer)+2
40-
# use normal to remove annoying 'hit enter messages'
41-
vim.command("normal :r!svn diff " + list_of_files + "\n")
42-
vim.command("set previewwindow ft=diff")
43-
vim.command("set buftype=nofile")
44-
vim.command("wincmd p")
45-
vim.command("wincmd R")
46-
vim.command('goto 1')
27+
let file = substitute(line, '\v^MM?\s*(.*)\s*$', '\1', '')
28+
let list_of_files = list_of_files . ' '.file
29+
endif
4730

48-
EOF
31+
let i = i + 1
32+
endwhile
33+
34+
new
35+
silent! setlocal ft=diff previewwindow bufhidden=delete nobackup noswf nobuflisted nowrap buftype=nofile
36+
exe 'normal :r!LANG=C svn diff ' . list_of_files . "\n"
37+
setlocal nomodifiable
38+
goto 1
39+
redraw!
40+
wincmd R
41+
wincmd p
42+
goto 1
43+
redraw!
4944
endfunction
45+
5046
set nowarn
5147

5248
call Svn_diff_windows()

0 commit comments

Comments
 (0)