Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " C-c K to commit files with diff and status
- " C-c k to commit files with empty buffer (faster)
- fun! SVK_FastCommit(size,diff,status)
- let file = tempname()
- exec a:size . 'split ' . file
- if a:diff
- call append(0, "==== DiffEND =====================================================")
- silent exec "0r !svk diff lib/"
- call append(0, "")
- call append(0, "==== Diff ========================================================")
- call append(0, "")
- endif
- if a:status
- silent exec "0r !svk status | grep -v '^?' "
- call append(0, "")
- call append(0, "==== Status ======================================================")
- endif
- call append(0,"")
- call cursor(1,1)
- setlocal modifiable
- setlocal noswapfile
- setlocal bufhidden=hide
- setlocal nobuflisted
- setlocal nowrap
- setlocal cursorline
- setlocal number
- setlocal fdc=0
- setfiletype svk-fast-commit
- setlocal syntax=svk-fast-commit
- syn match hr +^====.*$+
- syn match add "^+.*$"
- syn match del "^-.*$"
- hi link hr Identifier
- hi add ctermfg=red
- hi del ctermfg=Magenta
- exec 'autocmd BufWritePost <buffer> :call SVK_DoCommit("'. file .'")'
- autocmd BufWinLeave <buffer> :bw!
- " startinsert
- endf
- fun! SVK_DoCommit(file)
- call s:FilterFile(a:file)
- call system("svk ci -F " . a:file . " &" )
- endf
- fun! s:FilterFile(file)
- let lines = readfile(a:file)
- let newl = [ ]
- for l in lines
- if l =~ "^===="
- break
- endif
- call add(newl , l)
- endfor
- call writefile(newl,a:file)
- endf
- nmap <silent> <c-c>k :call SVK_FastCommit(8,0,0)<CR>
- nmap <silent> <c-c>K :call SVK_FastCommit(30,1,1)<CR>
Add Comment
Please, Sign In to add comment