comparison plugin/lawrencium.vim @ 58:621185a5fa48

Added ability to show diff summaries from the status window.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 14 Nov 2012 22:21:30 -0800
parents 220c9508ff62
children 396da6e76952
comparison
equal deleted inserted replaced
57:220c9508ff62 58:621185a5fa48
501 501
502 " Add some nice commands. 502 " Add some nice commands.
503 command! -buffer Hgstatusedit :call s:HgStatus_FileEdit() 503 command! -buffer Hgstatusedit :call s:HgStatus_FileEdit()
504 command! -buffer Hgstatusdiff :call s:HgStatus_Diff(0) 504 command! -buffer Hgstatusdiff :call s:HgStatus_Diff(0)
505 command! -buffer Hgstatusvdiff :call s:HgStatus_Diff(1) 505 command! -buffer Hgstatusvdiff :call s:HgStatus_Diff(1)
506 command! -buffer Hgstatusdiffsum :call s:HgStatus_DiffSummary(0)
507 command! -buffer Hgstatusvdiffsum :call s:HgStatus_DiffSummary(1)
506 command! -buffer Hgstatusrefresh :call s:HgStatus_Refresh() 508 command! -buffer Hgstatusrefresh :call s:HgStatus_Refresh()
507 command! -buffer -range Hgstatusaddremove :call s:HgStatus_AddRemove(<line1>, <line2>) 509 command! -buffer -range Hgstatusaddremove :call s:HgStatus_AddRemove(<line1>, <line2>)
508 command! -buffer -range=% -bang Hgstatuscommit :call s:HgStatus_Commit(<line1>, <line2>, <bang>0, 0) 510 command! -buffer -range=% -bang Hgstatuscommit :call s:HgStatus_Commit(<line1>, <line2>, <bang>0, 0)
509 command! -buffer -range=% -bang Hgstatusvcommit :call s:HgStatus_Commit(<line1>, <line2>, <bang>0, 1) 511 command! -buffer -range=% -bang Hgstatusvcommit :call s:HgStatus_Commit(<line1>, <line2>, <bang>0, 1)
510 command! -buffer -range=% -nargs=+ Hgstatusqnew :call s:HgStatus_QNew(<line1>, <line2>, <f-args>) 512 command! -buffer -range=% -nargs=+ Hgstatusqnew :call s:HgStatus_QNew(<line1>, <line2>, <f-args>)
515 nnoremap <buffer> <silent> <cr> :Hgstatusedit<cr> 517 nnoremap <buffer> <silent> <cr> :Hgstatusedit<cr>
516 nnoremap <buffer> <silent> <C-N> :call search('^[MARC\!\?I ]\s.', 'We')<cr> 518 nnoremap <buffer> <silent> <C-N> :call search('^[MARC\!\?I ]\s.', 'We')<cr>
517 nnoremap <buffer> <silent> <C-P> :call search('^[MARC\!\?I ]\s.', 'Wbe')<cr> 519 nnoremap <buffer> <silent> <C-P> :call search('^[MARC\!\?I ]\s.', 'Wbe')<cr>
518 nnoremap <buffer> <silent> <C-D> :Hgstatusdiff<cr> 520 nnoremap <buffer> <silent> <C-D> :Hgstatusdiff<cr>
519 nnoremap <buffer> <silent> <C-V> :Hgstatusvdiff<cr> 521 nnoremap <buffer> <silent> <C-V> :Hgstatusvdiff<cr>
522 nnoremap <buffer> <silent> <C-U> :Hgstatusdiffsum<cr>
523 nnoremap <buffer> <silent> <C-H> :Hgstatusvdiffsum<cr>
520 nnoremap <buffer> <silent> <C-A> :Hgstatusaddremove<cr> 524 nnoremap <buffer> <silent> <C-A> :Hgstatusaddremove<cr>
521 nnoremap <buffer> <silent> <C-S> :Hgstatuscommit<cr> 525 nnoremap <buffer> <silent> <C-S> :Hgstatuscommit<cr>
522 nnoremap <buffer> <silent> <C-R> :Hgstatusrefresh<cr> 526 nnoremap <buffer> <silent> <C-R> :Hgstatusrefresh<cr>
523 nnoremap <buffer> <silent> q :bdelete!<cr> 527 nnoremap <buffer> <silent> q :bdelete!<cr>
524 528
588 592
589 function! s:HgStatus_Diff(vertical) abort 593 function! s:HgStatus_Diff(vertical) abort
590 " Open the file and run `Hgdiff` on it. 594 " Open the file and run `Hgdiff` on it.
591 call s:HgStatus_FileEdit() 595 call s:HgStatus_FileEdit()
592 call s:HgDiff('%:p', a:vertical) 596 call s:HgDiff('%:p', a:vertical)
597 endfunction
598
599 function! s:HgStatus_DiffSummary(vertical) abort
600 " Get the path of the file the cursor is on.
601 let l:path = s:HgStatus_GetSelectedFile()
602 let l:split_type = 1
603 if a:vertical
604 let l:split_type = 2
605 endif
606 wincmd p
607 call s:HgDiffSummary(l:path, l:split_type)
593 endfunction 608 endfunction
594 609
595 function! s:HgStatus_QNew(linestart, lineend, patchname, ...) abort 610 function! s:HgStatus_QNew(linestart, lineend, patchname, ...) abort
596 " Get the selected filenames. 611 " Get the selected filenames.
597 let l:filenames = s:HgStatus_GetSelectedFiles(a:linestart, a:lineend, ['M', 'A', 'R']) 612 let l:filenames = s:HgStatus_GetSelectedFiles(a:linestart, a:lineend, ['M', 'A', 'R'])