The previous attempt to override Vim 7.4's window closing paranoia
didn't work that well. Closing the scratch buffer would result in
the commit message window being lost without saving changes.
The latest scheme is to mark the scratch buffer as a help buffer,
despite the documentation saying we aren't supposed to do that.
The result is that it will automatically be closed when it's the
last buffer standing, which is very close to what we want.
set ro
set nomodifiable
set nobuflisted
- set buftype=nowrite
- set bufhidden=hide
+ set buftype=help
setlocal noswapfile
exe "file \[ORIG:" . l:filename . "\]"
diffthis
set ro
set nomodifiable
set nobuflisted
- set buftype=nowrite
- set bufhidden=hide
+ set buftype=help
setlocal noswapfile
exe "file \[YOURS:" . l:filename . "\]"
diffthis
set ro
set nomodifiable
set nobuflisted
- set buftype=nowrite
+ set buftype=help
set bufhidden=hide
setlocal noswapfile
exe "file \[THEIRS:" . l:filename . "\]"
delete
" Allow closing an unmodified spec.
- set nomod
+ set nomodified
try
/everything below this line is just the diff/
" Delete the blank line left above the diff.
1
delete
+ set ro
+ set nomodified
+ set nomodifiable
set nobuflisted
- set buftype=nowrite
- set bufhidden=hide
+ set buftype=help
setlocal noswapfile
file [p4 diff\]
" Map q to quit easily.
nnoremap <silent> <buffer> q <C-W>q
- " Vim 7.4 really doesn't want us to quit windows from a script.
- try
- au QuitPre * qa!
- catch
- endtry
-
" Switch back to the top window and put the cursor by the description.
wincmd k
resize 10
" trying to run a sequence of normal mode commands.
fun! SVNcommit()
" Allow closing an unmodified spec.
- set nomod
+ set nomodified
" Get the modified files. Discount new files.
let l:files = system("sed -n '1,/^$/d;/^[MR]..../{s//\"/;s/$/\"/p;}' " . bufname(""))
" Delete the blank line left above the diff.
1
delete
- se nobuflisted
- set buftype=nowrite
- set bufhidden=hide
+ set ro
+ set nomodifiable
+ set nomodified
+ set nobuflisted
+ set buftype=help
setlocal noswapfile
file [svn diff\]
" Map q to quit easily.
nnoremap <silent> <buffer> q <C-W>q
- " Vim 7.4 really doesn't want us to quit windows from a script.
- try
- au QuitPre * qa!
- catch
- endtry
-
" Switch back to the top window.
wincmd k
endfun