equal
deleted
inserted
replaced
373 endfunction |
373 endfunction |
374 |
374 |
375 " Function: s:HGSetupBuffer() {{{2 |
375 " Function: s:HGSetupBuffer() {{{2 |
376 " Attempts to set the b:HGBranch, b:HGRevision and b:HGRepository variables. |
376 " Attempts to set the b:HGBranch, b:HGRevision and b:HGRepository variables. |
377 |
377 |
378 function! s:HGSetupBuffer() |
378 function! s:HGSetupBuffer(...) |
379 if (exists("b:HGBufferSetup") && b:HGBufferSetup) |
379 if (exists("b:HGBufferSetup") && b:HGBufferSetup && !exists('a:1')) |
380 " This buffer is already set up. |
380 " This buffer is already set up. |
381 return |
381 return |
382 endif |
382 endif |
383 |
383 |
384 if !s:HGGetOption("HGCommandEnableBufferSetup", 0) |
384 if !s:HGGetOption("HGCommandEnableBufferSetup", 0) |
606 function! HGEnableBufferSetup() |
606 function! HGEnableBufferSetup() |
607 let g:HGCommandEnableBufferSetup=1 |
607 let g:HGCommandEnableBufferSetup=1 |
608 augroup HGCommandPlugin |
608 augroup HGCommandPlugin |
609 au! |
609 au! |
610 au BufEnter * call s:HGSetupBuffer() |
610 au BufEnter * call s:HGSetupBuffer() |
|
611 " Force resetting up buffer on external file change (HG update) |
|
612 au FileChangedShell * call s:HGSetupBuffer(1) |
611 augroup END |
613 augroup END |
612 |
614 |
613 " Only auto-load if the plugin is fully loaded. This gives other plugins a |
615 " Only auto-load if the plugin is fully loaded. This gives other plugins a |
614 " chance to run. |
616 " chance to run. |
615 if g:loaded_hgcommand == 2 |
617 if g:loaded_hgcommand == 2 |
750 \ ':g/^HG:/d<CR>'. |
752 \ ':g/^HG:/d<CR>'. |
751 \ ':update<CR>'. |
753 \ ':update<CR>'. |
752 \ ':call <SID>HGFinishCommit("' . messageFileName . '",' . |
754 \ ':call <SID>HGFinishCommit("' . messageFileName . '",' . |
753 \ '"' . newCwd . '",' . |
755 \ '"' . newCwd . '",' . |
754 \ '"' . realFileName . '",' . |
756 \ '"' . realFileName . '",' . |
755 \ hgBufferCheck . ')<CR>' |
757 \ hgBufferCheck . ')<CR>'. |
|
758 \ ':call <SID>HGBufferSetup(1)<CR>' |
756 |
759 |
757 silent 0put ='HG: ----------------------------------------------------------------------' |
760 silent 0put ='HG: ----------------------------------------------------------------------' |
758 silent put =\"HG: Enter Log. Lines beginning with `HG:' are removed automatically\" |
761 silent put =\"HG: Enter Log. Lines beginning with `HG:' are removed automatically\" |
759 silent put ='HG: Type <leader>cc (or your own <Plug>HGCommit mapping)' |
762 silent put ='HG: Type <leader>cc (or your own <Plug>HGCommit mapping)' |
760 |
763 |
903 |
906 |
904 |
907 |
905 " Function: s:HGUpdate() {{{2 |
908 " Function: s:HGUpdate() {{{2 |
906 function! s:HGUpdate() |
909 function! s:HGUpdate() |
907 return s:HGMarkOrigBufferForSetup(s:HGDoCommand('update', 'update', '')) |
910 return s:HGMarkOrigBufferForSetup(s:HGDoCommand('update', 'update', '')) |
|
911 call s:HGSetupBuffer(1) |
908 endfunction |
912 endfunction |
909 |
913 |
910 " Function: s:HGVimDiff(...) {{{2 |
914 " Function: s:HGVimDiff(...) {{{2 |
911 function! s:HGVimDiff(...) |
915 function! s:HGVimDiff(...) |
912 let originalBuffer = s:HGCurrentBufferCheck() |
916 let originalBuffer = s:HGCurrentBufferCheck() |
1168 au BufUnload * call s:HGVimDiffRestore(expand("<abuf>")) |
1172 au BufUnload * call s:HGVimDiffRestore(expand("<abuf>")) |
1169 augroup END |
1173 augroup END |
1170 |
1174 |
1171 " Section: Optional activation of buffer management {{{1 |
1175 " Section: Optional activation of buffer management {{{1 |
1172 |
1176 |
1173 if s:HGGetOption('HGCommandEnableBufferSetup', 0) |
1177 if s:HGGetOption('HGCommandEnableBufferSetup', 1) |
1174 call HGEnableBufferSetup() |
1178 call HGEnableBufferSetup() |
1175 endif |
1179 endif |
1176 |
1180 |
1177 " Section: Doc installation {{{1 |
1181 " Section: Doc installation {{{1 |
1178 " |
1182 " |
1628 that it attempts to set two buffer variables ('HGRevision' and 'HGBranch') |
1632 that it attempts to set two buffer variables ('HGRevision' and 'HGBranch') |
1629 upon entry into a buffer. This is rather slow because it means that 'hg |
1633 upon entry into a buffer. This is rather slow because it means that 'hg |
1630 status' will be invoked at each entry into a buffer (during the |BufEnter| |
1634 status' will be invoked at each entry into a buffer (during the |BufEnter| |
1631 autocommand). |
1635 autocommand). |
1632 |
1636 |
1633 This mode is disabled by default. In order to enable it, set the |
1637 This mode is enablmed by default. In order to disable it, set the |
1634 |HGCommandEnableBufferSetup| variable to a true (non-zero) value. Enabling |
1638 |HGCommandEnableBufferSetup| variable to a false (zero) value. Enabling |
1635 this mode simply provides the buffer variables mentioned above. The user |
1639 this mode simply provides the buffer variables mentioned above. The user |
1636 must explicitly include those in the |'statusline'| option if they are to |
1640 must explicitly include those in the |'statusline'| option if they are to |
1637 appear in the status line (but see |hgcommand-statusline| for a simple way |
1641 appear in the status line (but see |hgcommand-statusline| for a simple way |
1638 to do that). |
1642 to do that). |
1639 |
1643 |