Show More
This diff has been collapsed as it changes many lines, (580 lines changed) Show them Hide them | |||
@@ -3,7 +3,7 b'' | |||
|
3 | 3 | " Vim plugin to assist in working with HG-controlled files. |
|
4 | 4 | " |
|
5 | 5 | " Last Change: 2006/02/22 |
|
6 |
" Version: 1.7 |
|
|
6 | " Version: 1.77 | |
|
7 | 7 | " Maintainer: Mathieu Clabaut <mathieu.clabaut@gmail.com> |
|
8 | 8 | " License: This file is placed in the public domain. |
|
9 | 9 | " Credits: |
@@ -13,7 +13,7 b'' | |||
|
13 | 13 | |
|
14 | 14 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
15 | 15 | " |
|
16 |
" Section: Documentation |
|
|
16 | " Section: Documentation | |
|
17 | 17 | "---------------------------- |
|
18 | 18 | " |
|
19 | 19 | " Documentation should be available by ":help hgcommand" command, once the |
@@ -21,7 +21,7 b'' | |||
|
21 | 21 | " |
|
22 | 22 | " You still can read the documentation at the end of this file. Locate it by |
|
23 | 23 | " searching the "hgcommand-contents" string (and set ft=help to have |
|
24 |
" appropriate syntaxic coloration). |
|
|
24 | " appropriate syntaxic coloration). | |
|
25 | 25 | |
|
26 | 26 | " Section: Plugin header {{{1 |
|
27 | 27 | |
@@ -34,11 +34,33 b' if exists("loaded_hgcommand")' | |||
|
34 | 34 | endif |
|
35 | 35 | let loaded_hgcommand = 1 |
|
36 | 36 | |
|
37 | " store 'compatible' settings | |
|
38 | let s:save_cpo = &cpo | |
|
39 | set cpo&vim | |
|
40 | ||
|
41 | " run checks | |
|
42 | let s:script_name = expand("<sfile>:t:r") | |
|
43 | ||
|
44 | function! s:HGCleanupOnFailure(err) | |
|
45 | echohl WarningMsg | |
|
46 | echomsg s:script_name . ":" a:err "Plugin not loaded" | |
|
47 | echohl None | |
|
48 | let loaded_hgcommand = "no" | |
|
49 | unlet s:save_cpo s:script_name | |
|
50 | endfunction | |
|
51 | ||
|
37 | 52 | if v:version < 602 |
|
38 | echohl WarningMsg|echomsg "HGCommand 1.69 or later requires VIM 6.2 or later"|echohl None | |
|
53 | call <SID>HGCleanupOnFailure("VIM 6.2 or later required.") | |
|
39 | 54 | finish |
|
40 | 55 | endif |
|
41 | 56 | |
|
57 | if !exists("*system") | |
|
58 | call <SID>HGCleanupOnFailure("builtin system() function required.") | |
|
59 | finish | |
|
60 | endif | |
|
61 | ||
|
62 | let s:script_version = "v0.2" | |
|
63 | ||
|
42 | 64 | " Section: Event group setup {{{1 |
|
43 | 65 | |
|
44 | 66 | augroup HGCommand |
@@ -63,7 +85,7 b' unlet! s:vimDiffScratchList' | |||
|
63 | 85 | function! s:HGResolveLink(fileName) |
|
64 | 86 | let resolved = resolve(a:fileName) |
|
65 | 87 | if resolved != a:fileName |
|
66 |
let resolved = |
|
|
88 | let resolved = <SID>HGResolveLink(resolved) | |
|
67 | 89 | endif |
|
68 | 90 | return resolved |
|
69 | 91 | endfunction |
@@ -74,7 +96,7 b' endfunction' | |||
|
74 | 96 | |
|
75 | 97 | function! s:HGChangeToCurrentFileDir(fileName) |
|
76 | 98 | let oldCwd=getcwd() |
|
77 |
let fileName= |
|
|
99 | let fileName=<SID>HGResolveLink(a:fileName) | |
|
78 | 100 | let newCwd=fnamemodify(fileName, ':h') |
|
79 | 101 | if strlen(newCwd) > 0 |
|
80 | 102 | execute 'cd' escape(newCwd, ' ') |
@@ -82,7 +104,7 b' function! s:HGChangeToCurrentFileDir(fil' | |||
|
82 | 104 | return oldCwd |
|
83 | 105 | endfunction |
|
84 | 106 | |
|
85 |
" Function: |
|
|
107 | " Function: <SID>HGGetOption(name, default) {{{2 | |
|
86 | 108 | " Grab a user-specified option to override the default provided. Options are |
|
87 | 109 | " searched in the window, buffer, then global spaces. |
|
88 | 110 | |
@@ -110,9 +132,9 b' function! s:HGEditFile(name, origBuffNR)' | |||
|
110 | 132 | "Name parameter will be pasted into expression. |
|
111 | 133 | let name = escape(a:name, ' *?\') |
|
112 | 134 | |
|
113 |
let editCommand = |
|
|
135 | let editCommand = <SID>HGGetOption('HGCommandEdit', 'edit') | |
|
114 | 136 | if editCommand != 'edit' |
|
115 |
if |
|
|
137 | if <SID>HGGetOption('HGCommandSplit', 'horizontal') == 'horizontal' | |
|
116 | 138 | if name == "" |
|
117 | 139 | let editCommand = 'rightbelow new' |
|
118 | 140 | else |
@@ -154,8 +176,8 b' function! s:HGCreateCommandBuffer(cmd, c' | |||
|
154 | 176 | |
|
155 | 177 | let resultBufferName='' |
|
156 | 178 | |
|
157 |
if |
|
|
158 |
let nameMarker = |
|
|
179 | if <SID>HGGetOption("HGCommandNameResultBuffers", 0) | |
|
180 | let nameMarker = <SID>HGGetOption("HGCommandNameMarker", '_') | |
|
159 | 181 | if strlen(a:statusText) > 0 |
|
160 | 182 | let bufName=a:cmdName . ' -- ' . a:statusText |
|
161 | 183 | else |
@@ -170,7 +192,7 b' function! s:HGCreateCommandBuffer(cmd, c' | |||
|
170 | 192 | endwhile |
|
171 | 193 | endif |
|
172 | 194 | |
|
173 |
let hgCommand = |
|
|
195 | let hgCommand = <SID>HGGetOption("HGCommandHGExec", "hg") . " " . a:cmd | |
|
174 | 196 | "echomsg "DBG :".hgCommand |
|
175 | 197 | let hgOut = system(hgCommand) |
|
176 | 198 | " HACK: diff command does not return proper error codes |
@@ -192,7 +214,7 b' function! s:HGCreateCommandBuffer(cmd, c' | |||
|
192 | 214 | return -1 |
|
193 | 215 | endif |
|
194 | 216 | |
|
195 |
if |
|
|
217 | if <SID>HGEditFile(resultBufferName, a:origBuffNR) == -1 | |
|
196 | 218 | return -1 |
|
197 | 219 | endif |
|
198 | 220 | |
@@ -200,7 +222,7 b' function! s:HGCreateCommandBuffer(cmd, c' | |||
|
200 | 222 | set noswapfile |
|
201 | 223 | set filetype= |
|
202 | 224 | |
|
203 |
if |
|
|
225 | if <SID>HGGetOption("HGCommandDeleteOnHide", 0) | |
|
204 | 226 | set bufhidden=delete |
|
205 | 227 | endif |
|
206 | 228 | |
@@ -213,8 +235,8 b' function! s:HGCreateCommandBuffer(cmd, c' | |||
|
213 | 235 | " This could be fixed by explicitly detecting whether the last line is |
|
214 | 236 | " within a fold, but I prefer to simply unfold the result buffer altogether. |
|
215 | 237 | |
|
216 |
if has( |
|
|
217 | normal zR | |
|
238 | if has("folding") | |
|
239 | setlocal nofoldenable | |
|
218 | 240 | endif |
|
219 | 241 | |
|
220 | 242 | $d |
@@ -243,7 +265,7 b' function! s:HGBufferCheck(hgBuffer)' | |||
|
243 | 265 | return origBuffer |
|
244 | 266 | else |
|
245 | 267 | " Original buffer no longer exists. |
|
246 |
return -1 |
|
|
268 | return -1 | |
|
247 | 269 | endif |
|
248 | 270 | else |
|
249 | 271 | " No original buffer |
@@ -256,7 +278,7 b' endfunction' | |||
|
256 | 278 | " for the current buffer. |
|
257 | 279 | |
|
258 | 280 | function! s:HGCurrentBufferCheck() |
|
259 |
return |
|
|
281 | return <SID>HGBufferCheck(bufnr("%")) | |
|
260 | 282 | endfunction |
|
261 | 283 | |
|
262 | 284 | " Function: s:HGToggleDeleteOnHide() {{{2 |
@@ -275,8 +297,8 b' endfunction' | |||
|
275 | 297 | " Returns: name of the new command buffer containing the command results |
|
276 | 298 | |
|
277 | 299 | function! s:HGDoCommand(cmd, cmdName, statusText) |
|
278 |
let hgBufferCheck= |
|
|
279 |
if hgBufferCheck == -1 |
|
|
300 | let hgBufferCheck=<SID>HGCurrentBufferCheck() | |
|
301 | if hgBufferCheck == -1 | |
|
280 | 302 | echo "Original buffer no longer exists, aborting." |
|
281 | 303 | return -1 |
|
282 | 304 | endif |
@@ -285,8 +307,8 b' function! s:HGDoCommand(cmd, cmdName, st' | |||
|
285 | 307 | if isdirectory(fileName) |
|
286 | 308 | let fileName=fileName . "/" . getline(".") |
|
287 | 309 | endif |
|
288 |
let realFileName = fnamemodify( |
|
|
289 |
let oldCwd= |
|
|
310 | let realFileName = fnamemodify(<SID>HGResolveLink(fileName), ':t') | |
|
311 | let oldCwd=<SID>HGChangeToCurrentFileDir(fileName) | |
|
290 | 312 | try |
|
291 | 313 | " TODO |
|
292 | 314 | "if !filereadable('HG/Root') |
@@ -294,7 +316,7 b' function! s:HGDoCommand(cmd, cmdName, st' | |||
|
294 | 316 | "endif |
|
295 | 317 | let fullCmd = a:cmd . ' "' . realFileName . '"' |
|
296 | 318 | "echomsg "DEBUG".fullCmd |
|
297 |
let resultBuffer= |
|
|
319 | let resultBuffer=<SID>HGCreateCommandBuffer(fullCmd, a:cmdName, a:statusText, hgBufferCheck) | |
|
298 | 320 | return resultBuffer |
|
299 | 321 | catch |
|
300 | 322 | echoerr v:exception |
@@ -314,17 +336,17 b' endfunction' | |||
|
314 | 336 | " Returns: string to be exec'd that sets the multiple return values. |
|
315 | 337 | |
|
316 | 338 | function! s:HGGetStatusVars(revisionVar, branchVar, repositoryVar) |
|
317 |
let hgBufferCheck= |
|
|
339 | let hgBufferCheck=<SID>HGCurrentBufferCheck() | |
|
318 | 340 | "echomsg "DBG : in HGGetStatusVars" |
|
319 |
if hgBufferCheck == -1 |
|
|
341 | if hgBufferCheck == -1 | |
|
320 | 342 | return "" |
|
321 | 343 | endif |
|
322 | 344 | let fileName=bufname(hgBufferCheck) |
|
323 |
let fileNameWithoutLink= |
|
|
345 | let fileNameWithoutLink=<SID>HGResolveLink(fileName) | |
|
324 | 346 | let realFileName = fnamemodify(fileNameWithoutLink, ':t') |
|
325 |
let oldCwd= |
|
|
347 | let oldCwd=<SID>HGChangeToCurrentFileDir(realFileName) | |
|
326 | 348 | try |
|
327 |
let hgCommand = |
|
|
349 | let hgCommand = <SID>HGGetOption("HGCommandHGExec", "hg") . " root " | |
|
328 | 350 | let roottext=system(hgCommand) |
|
329 | 351 | " Suppress ending null char ! Does it work in window ? |
|
330 | 352 | let roottext=substitute(roottext,'^.*/\([^/\n\r]*\)\n\_.*$','\1','') |
@@ -335,22 +357,22 b' function! s:HGGetStatusVars(revisionVar,' | |||
|
335 | 357 | if a:repositoryVar != "" |
|
336 | 358 | let returnExpression=returnExpression . " | let " . a:repositoryVar . "='" . roottext . "'" |
|
337 | 359 | endif |
|
338 |
let hgCommand = |
|
|
360 | let hgCommand = <SID>HGGetOption("HGCommandHGExec", "hg") . " status -mardui " . realFileName | |
|
339 | 361 | let statustext=system(hgCommand) |
|
340 | 362 | if(v:shell_error) |
|
341 | 363 | return "" |
|
342 | 364 | endif |
|
343 |
if match(statustext, '^[?I]') >= 0 |
|
|
365 | if match(statustext, '^[?I]') >= 0 | |
|
344 | 366 | let revision="NEW" |
|
345 |
elseif match(statustext, '^[R]') >= 0 |
|
|
367 | elseif match(statustext, '^[R]') >= 0 | |
|
346 | 368 | let revision="REMOVED" |
|
347 |
elseif match(statustext, '^[D]') >= 0 |
|
|
369 | elseif match(statustext, '^[D]') >= 0 | |
|
348 | 370 | let revision="DELETED" |
|
349 |
elseif match(statustext, '^[A]') >= 0 |
|
|
371 | elseif match(statustext, '^[A]') >= 0 | |
|
350 | 372 | let revision="ADDED" |
|
351 | 373 | else |
|
352 | 374 | " The file is tracked, we can try to get is revision number |
|
353 |
let hgCommand = |
|
|
375 | let hgCommand = <SID>HGGetOption("HGCommandHGExec", "hg") . " parents -b " | |
|
354 | 376 | let statustext=system(hgCommand) |
|
355 | 377 | if(v:shell_error) |
|
356 | 378 | return "" |
@@ -381,7 +403,7 b' function! s:HGSetupBuffer(...)' | |||
|
381 | 403 | return |
|
382 | 404 | endif |
|
383 | 405 | |
|
384 |
if ! |
|
|
406 | if !<SID>HGGetOption("HGCommandEnableBufferSetup", 0) | |
|
385 | 407 | \ || @% == "" |
|
386 | 408 | \ || s:HGCommandEditFileRunning > 0 |
|
387 | 409 | \ || exists("b:HGOrigBuffNR") |
@@ -399,7 +421,7 b' function! s:HGSetupBuffer(...)' | |||
|
399 | 421 | let branch="" |
|
400 | 422 | let repository="" |
|
401 | 423 | |
|
402 |
exec |
|
|
424 | exec <SID>HGGetStatusVars('revision', 'branch', 'repository') | |
|
403 | 425 | "echomsg "DBG ".revision."#".branch."#".repository |
|
404 | 426 | if revision != "" |
|
405 | 427 | let b:HGRevision=revision |
@@ -427,7 +449,7 b' endfunction' | |||
|
427 | 449 | function! s:HGMarkOrigBufferForSetup(hgBuffer) |
|
428 | 450 | checktime |
|
429 | 451 | if a:hgBuffer != -1 |
|
430 |
let origBuffer = |
|
|
452 | let origBuffer = <SID>HGBufferCheck(a:hgBuffer) | |
|
431 | 453 | "This should never not work, but I'm paranoid |
|
432 | 454 | if origBuffer != a:hgBuffer |
|
433 | 455 | call setbufvar(origBuffer, "HGBufferSetup", 0) |
@@ -436,7 +458,7 b' function! s:HGMarkOrigBufferForSetup(hgB' | |||
|
436 | 458 | "We are presumably in the original buffer |
|
437 | 459 | let b:HGBufferSetup = 0 |
|
438 | 460 | "We do the setup now as now event will be triggered allowing it later. |
|
439 |
call |
|
|
461 | call <SID>HGSetupBuffer() | |
|
440 | 462 | endif |
|
441 | 463 | return a:hgBuffer |
|
442 | 464 | endfunction |
@@ -483,11 +505,12 b' function! s:HGFlexiMkdir(dir)' | |||
|
483 | 505 | if exists("*mkdir") " we can use Vim's own mkdir() |
|
484 | 506 | call mkdir(a:dir) |
|
485 | 507 | elseif !exists("+shellslash") |
|
486 |
call system( |
|
|
508 | call system("mkdir -p '".a:dir."'") | |
|
487 | 509 | else " M$ |
|
488 | 510 | let l:ssl = &shellslash |
|
489 | 511 | try |
|
490 | 512 | set shellslash |
|
513 | " no single quotes? | |
|
491 | 514 | call system('mkdir "'.a:dir.'"') |
|
492 | 515 | finally |
|
493 | 516 | let &shellslash = l:ssl |
@@ -495,19 +518,18 b' function! s:HGFlexiMkdir(dir)' | |||
|
495 | 518 | endif |
|
496 | 519 | endfunction |
|
497 | 520 | |
|
498 |
function! s:HGInstallDocumentation(full_name |
|
|
521 | function! s:HGInstallDocumentation(full_name) | |
|
499 | 522 | " Figure out document path based on full name of this script: |
|
500 |
let l:vim_ |
|
|
501 | let l:vim_doc_path = fnamemodify(a:full_name, ':h:h') . "/doc" | |
|
523 | let l:vim_doc_path = fnamemodify(a:full_name, ":h:h") . "/doc" | |
|
502 | 524 | if filewritable(l:vim_doc_path) != 2 |
|
503 |
echomsg |
|
|
525 | echomsg s:script_name . ": Trying to update docs at" l:vim_doc_path | |
|
504 | 526 | silent! call <SID>HGFlexiMkdir(l:vim_doc_path) |
|
505 | 527 | if filewritable(l:vim_doc_path) != 2 |
|
506 | 528 | " Try first item in 'runtimepath': |
|
507 | let l:vimfiles = matchstr(&runtimepath, '[^,]\+\ze,') | |
|
508 | let l:vim_doc_path = l:vimfiles . "/doc" | |
|
529 | let l:vim_doc_path = | |
|
530 | \ substitute(&runtimepath, '^\([^,]*\).*', '\1/doc', 'e') | |
|
509 | 531 | if filewritable(l:vim_doc_path) != 2 |
|
510 |
echomsg |
|
|
532 | echomsg s:script_name . ": Trying to update docs at" l:vim_doc_path | |
|
511 | 533 | silent! call <SID>HGFlexiMkdir(l:vim_doc_path) |
|
512 | 534 | if filewritable(l:vim_doc_path) != 2 |
|
513 | 535 | " Put a warning: |
@@ -519,54 +541,51 b' function! s:HGInstallDocumentation(full_' | |||
|
519 | 541 | endif |
|
520 | 542 | endif |
|
521 | 543 | |
|
522 |
" Full name of |
|
|
523 | let l:script_name = fnamemodify(a:full_name, ':t') | |
|
524 | let l:doc_name = fnamemodify(a:full_name, ':t:r') . '.txt' | |
|
525 | let l:doc_file = l:vim_doc_path . "/" . l:doc_name | |
|
526 | ||
|
544 | " Full name of documentation file: | |
|
545 | let l:doc_file = | |
|
546 | \ l:vim_doc_path . "/" . s:script_name . ".txt" | |
|
527 | 547 | " Bail out if document file is still up to date: |
|
528 | if filereadable(l:doc_file) && getftime(a:full_name) < getftime(l:doc_file) | |
|
548 | if filereadable(l:doc_file) && | |
|
549 | \ getftime(a:full_name) < getftime(l:doc_file) | |
|
529 | 550 | return 0 |
|
530 | 551 | endif |
|
531 | 552 | |
|
553 | " temporary global settings | |
|
554 | let l:lz = &lazyredraw | |
|
555 | let l:hls = &hlsearch | |
|
556 | set lazyredraw nohlsearch | |
|
532 | 557 | " Create a new buffer & read in the plugin file (me): |
|
533 | setl nomodeline | |
|
534 | 1 new! | |
|
535 | setl noswapfile modifiable | |
|
536 | sil exe 'read ' . a:full_name | |
|
558 | 1 new | |
|
559 | setlocal noswapfile modifiable nomodeline | |
|
560 | if has("folding") | |
|
561 | setlocal nofoldenable | |
|
562 | endif | |
|
563 | silent execute "read" escape(a:full_name, " ") | |
|
564 | let l:doc_buf = bufnr("%") | |
|
537 | 565 | |
|
538 | setl modeline | |
|
539 | let l:buf = bufnr("%") | |
|
540 | ||
|
541 | norm zR | |
|
542 | norm gg | |
|
543 | ||
|
566 | 1 | |
|
544 | 567 | " Delete from first line to a line starts with |
|
545 | 568 | " === START_DOC |
|
546 | sil 1,/^=\{3,}\s\+START_DOC\C/ d | |
|
547 | ||
|
569 | silent 1,/^=\{3,}\s\+START_DOC\C/ d | |
|
548 | 570 | " Delete from a line starts with |
|
549 | 571 | " === END_DOC |
|
550 | 572 | " to the end of the documents: |
|
551 | sil /^=\{3,}\s\+END_DOC\C/,$ d | |
|
552 | ||
|
553 | " Remove fold marks: | |
|
554 | sil %s/{\{3}[1-9]/ /e | |
|
573 | silent /^=\{3,}\s\+END_DOC\C/,$ d | |
|
555 | 574 | |
|
556 | 575 | " Add modeline for help doc: the modeline string is mangled intentionally |
|
557 | 576 | " to avoid it be recognized by VIM: |
|
558 |
call append(line( |
|
|
559 |
call append(line( |
|
|
577 | call append(line("$"), "") | |
|
578 | call append(line("$"), " v" . "im:tw=78:ts=8:ft=help:norl:") | |
|
560 | 579 | |
|
561 | 580 | " Replace revision: |
|
562 |
sil exe "normal :1s/#version#/ |
|
|
563 | ||
|
581 | silent execute "normal :1s/#version#/" . s:script_version . "/\<CR>" | |
|
564 | 582 | " Save the help document and wipe out buffer: |
|
565 |
sil exe |
|
|
566 | ||
|
583 | silent execute "wq!" escape(l:doc_file, " ") "| bw" l:doc_buf | |
|
567 | 584 | " Build help tags: |
|
568 |
sil exe |
|
|
585 | silent execute "helptags" l:vim_doc_path | |
|
569 | 586 | |
|
587 | let &hlsearch = l:hls | |
|
588 | let &lazyredraw = l:lz | |
|
570 | 589 | return 1 |
|
571 | 590 | endfunction |
|
572 | 591 | |
@@ -578,7 +597,7 b' endfunction' | |||
|
578 | 597 | |
|
579 | 598 | function! HGGetRevision() |
|
580 | 599 | let revision="" |
|
581 |
exec |
|
|
600 | exec <SID>HGGetStatusVars('revision', '', '') | |
|
582 | 601 | return revision |
|
583 | 602 | endfunction |
|
584 | 603 | |
@@ -597,16 +616,16 b' function! HGEnableBufferSetup()' | |||
|
597 | 616 | let g:HGCommandEnableBufferSetup=1 |
|
598 | 617 | augroup HGCommandPlugin |
|
599 | 618 | au! |
|
600 |
au BufEnter * call |
|
|
601 |
au BufWritePost * call |
|
|
619 | au BufEnter * call <SID>HGSetupBuffer() | |
|
620 | au BufWritePost * call <SID>HGSetupBuffer() | |
|
602 | 621 | " Force resetting up buffer on external file change (HG update) |
|
603 |
au FileChangedShell * call |
|
|
622 | au FileChangedShell * call <SID>HGSetupBuffer(1) | |
|
604 | 623 | augroup END |
|
605 | 624 | |
|
606 | 625 | " Only auto-load if the plugin is fully loaded. This gives other plugins a |
|
607 | 626 | " chance to run. |
|
608 | 627 | if g:loaded_hgcommand == 2 |
|
609 |
call |
|
|
628 | call <SID>HGSetupBuffer() | |
|
610 | 629 | endif |
|
611 | 630 | endfunction |
|
612 | 631 | |
@@ -647,7 +666,7 b' endfunction' | |||
|
647 | 666 | |
|
648 | 667 | " Function: s:HGAdd() {{{2 |
|
649 | 668 | function! s:HGAdd() |
|
650 |
return |
|
|
669 | return <SID>HGMarkOrigBufferForSetup(<SID>HGDoCommand('add', 'hgadd', '')) | |
|
651 | 670 | endfunction |
|
652 | 671 | |
|
653 | 672 | " Function: s:HGAnnotate(...) {{{2 |
@@ -657,7 +676,7 b' function! s:HGAnnotate(...)' | |||
|
657 | 676 | " This is a HGAnnotate buffer. Perform annotation of the version |
|
658 | 677 | " indicated by the current line. |
|
659 | 678 | let revision = substitute(getline("."),'\(^[0-9]*\):.*','\1','') |
|
660 |
if |
|
|
679 | if <SID>HGGetOption('HGCommandAnnotateParent', 0) != 0 && revision > 0 | |
|
661 | 680 | let revision = revision - 1 |
|
662 | 681 | endif |
|
663 | 682 | else |
@@ -676,7 +695,7 b' function! s:HGAnnotate(...)' | |||
|
676 | 695 | return -1 |
|
677 | 696 | endif |
|
678 | 697 | |
|
679 |
let resultBuffer= |
|
|
698 | let resultBuffer=<SID>HGDoCommand('annotate -ndu -r ' . revision, 'hgannotate', revision) | |
|
680 | 699 | "echomsg "DBG: ".resultBuffer |
|
681 | 700 | if resultBuffer != -1 |
|
682 | 701 | set filetype=HGAnnotate |
@@ -691,10 +710,10 b' function! s:HGCommit(...)' | |||
|
691 | 710 | " is used; if bang is supplied, an empty message is used; otherwise, the |
|
692 | 711 | " user is provided a buffer from which to edit the commit message. |
|
693 | 712 | if a:2 != "" || a:1 == "!" |
|
694 |
return |
|
|
713 | return <SID>HGMarkOrigBufferForSetup(<SID>HGDoCommand('commit -m "' . a:2 . '"', 'hgcommit', '')) | |
|
695 | 714 | endif |
|
696 | 715 | |
|
697 |
let hgBufferCheck= |
|
|
716 | let hgBufferCheck=<SID>HGCurrentBufferCheck() | |
|
698 | 717 | if hgBufferCheck == -1 |
|
699 | 718 | echo "Original buffer no longer exists, aborting." |
|
700 | 719 | return -1 |
@@ -710,7 +729,7 b' function! s:HGCommit(...)' | |||
|
710 | 729 | let messageFileName = tempname() |
|
711 | 730 | |
|
712 | 731 | let fileName=bufname(hgBufferCheck) |
|
713 |
let realFilePath= |
|
|
732 | let realFilePath=<SID>HGResolveLink(fileName) | |
|
714 | 733 | let newCwd=fnamemodify(realFilePath, ':h') |
|
715 | 734 | if strlen(newCwd) == 0 |
|
716 | 735 | " Account for autochdir being in effect, which will make this blank, but |
@@ -720,7 +739,7 b' function! s:HGCommit(...)' | |||
|
720 | 739 | |
|
721 | 740 | let realFileName=fnamemodify(realFilePath, ':t') |
|
722 | 741 | |
|
723 |
if |
|
|
742 | if <SID>HGEditFile(messageFileName, hgBufferCheck) == -1 | |
|
724 | 743 | return |
|
725 | 744 | endif |
|
726 | 745 | |
@@ -751,9 +770,9 b' function! s:HGCommit(...)' | |||
|
751 | 770 | silent put =\"HG: Enter Log. Lines beginning with `HG:' are removed automatically\" |
|
752 | 771 | silent put ='HG: Type <leader>cc (or your own <Plug>HGCommit mapping)' |
|
753 | 772 | |
|
754 |
if |
|
|
773 | if <SID>HGGetOption('HGCommandCommitOnWrite', 1) == 1 | |
|
755 | 774 | execute 'au HGCommit BufWritePre' autoPattern 'g/^HG:/d' |
|
756 |
execute 'au HGCommit BufWritePost' autoPattern 'call |
|
|
775 | execute 'au HGCommit BufWritePost' autoPattern 'call <SID>HGFinishCommit("' . messageFileName . '", "' . newCwd . '", "' . realFileName . '", ' . hgBufferCheck . ') | au! * ' autoPattern | |
|
757 | 776 | silent put ='HG: or write this buffer' |
|
758 | 777 | endif |
|
759 | 778 | |
@@ -782,7 +801,7 b' function! s:HGDiff(...)' | |||
|
782 | 801 | let caption = '' |
|
783 | 802 | endif |
|
784 | 803 | |
|
785 |
let hgdiffopt= |
|
|
804 | let hgdiffopt=<SID>HGGetOption('HGCommandDiffOpt', 'w') | |
|
786 | 805 | |
|
787 | 806 | if hgdiffopt == "" |
|
788 | 807 | let diffoptionstring="" |
@@ -790,8 +809,8 b' function! s:HGDiff(...)' | |||
|
790 | 809 | let diffoptionstring=" -" . hgdiffopt . " " |
|
791 | 810 | endif |
|
792 | 811 | |
|
793 |
let resultBuffer = |
|
|
794 |
if resultBuffer != -1 |
|
|
812 | let resultBuffer = <SID>HGDoCommand('diff ' . diffoptionstring . revOptions , 'hgdiff', caption) | |
|
813 | if resultBuffer != -1 | |
|
795 | 814 | set filetype=diff |
|
796 | 815 | endif |
|
797 | 816 | return resultBuffer |
@@ -800,7 +819,7 b' endfunction' | |||
|
800 | 819 | |
|
801 | 820 | " Function: s:HGGotoOriginal(["!]) {{{2 |
|
802 | 821 | function! s:HGGotoOriginal(...) |
|
803 |
let origBuffNR = |
|
|
822 | let origBuffNR = <SID>HGCurrentBufferCheck() | |
|
804 | 823 | if origBuffNR > 0 |
|
805 | 824 | let origWinNR = bufwinnr(origBuffNR) |
|
806 | 825 | if origWinNR == -1 |
@@ -830,11 +849,11 b' function! s:HGFinishCommit(messageFile, ' | |||
|
830 | 849 | if strlen(a:targetDir) > 0 |
|
831 | 850 | execute 'cd' escape(a:targetDir, ' ') |
|
832 | 851 | endif |
|
833 |
let resultBuffer= |
|
|
852 | let resultBuffer=<SID>HGCreateCommandBuffer('commit -l "' . a:messageFile . '" "'. a:targetFile . '"', 'hgcommit', '', a:origBuffNR) | |
|
834 | 853 | execute 'cd' escape(oldCwd, ' ') |
|
835 | 854 | execute 'bw' escape(a:messageFile, ' *?\') |
|
836 | 855 | silent execute 'call delete("' . a:messageFile . '")' |
|
837 |
return |
|
|
856 | return <SID>HGMarkOrigBufferForSetup(resultBuffer) | |
|
838 | 857 | else |
|
839 | 858 | echoerr "Can't read message file; no commit is possible." |
|
840 | 859 | return -1 |
@@ -851,7 +870,7 b' function! s:HGLog(...)' | |||
|
851 | 870 | let caption = a:1 |
|
852 | 871 | endif |
|
853 | 872 | |
|
854 |
let resultBuffer= |
|
|
873 | let resultBuffer=<SID>HGDoCommand('log' . versionOption, 'hglog', caption) | |
|
855 | 874 | if resultBuffer != "" |
|
856 | 875 | set filetype=rcslog |
|
857 | 876 | endif |
@@ -860,14 +879,14 b' endfunction' | |||
|
860 | 879 | |
|
861 | 880 | " Function: s:HGRevert() {{{2 |
|
862 | 881 | function! s:HGRevert() |
|
863 |
return |
|
|
882 | return <SID>HGMarkOrigBufferForSetup(<SID>HGDoCommand('revert', 'hgrevert', '')) | |
|
864 | 883 | endfunction |
|
865 | 884 | |
|
866 | 885 | " Function: s:HGReview(...) {{{2 |
|
867 | 886 | function! s:HGReview(...) |
|
868 | 887 | if a:0 == 0 |
|
869 | 888 | let versiontag="" |
|
870 |
if |
|
|
889 | if <SID>HGGetOption('HGCommandInteractive', 0) | |
|
871 | 890 | let versiontag=input('Revision: ') |
|
872 | 891 | endif |
|
873 | 892 | if versiontag == "" |
@@ -881,7 +900,7 b' function! s:HGReview(...)' | |||
|
881 | 900 | let versionOption=" -r " . versiontag . " " |
|
882 | 901 | endif |
|
883 | 902 | |
|
884 |
let resultBuffer = |
|
|
903 | let resultBuffer = <SID>HGDoCommand('cat' . versionOption, 'hgreview', versiontag) | |
|
885 | 904 | if resultBuffer > 0 |
|
886 | 905 | let &filetype=getbufvar(b:HGOrigBuffNR, '&filetype') |
|
887 | 906 | endif |
@@ -891,18 +910,18 b' endfunction' | |||
|
891 | 910 | |
|
892 | 911 | " Function: s:HGStatus() {{{2 |
|
893 | 912 | function! s:HGStatus() |
|
894 |
return |
|
|
913 | return <SID>HGDoCommand('status', 'hgstatus', '') | |
|
895 | 914 | endfunction |
|
896 | 915 | |
|
897 | 916 | |
|
898 | 917 | " Function: s:HGUpdate() {{{2 |
|
899 | 918 | function! s:HGUpdate() |
|
900 |
return |
|
|
919 | return <SID>HGMarkOrigBufferForSetup(<SID>HGDoCommand('update', 'update', '')) | |
|
901 | 920 | endfunction |
|
902 | 921 | |
|
903 | 922 | " Function: s:HGVimDiff(...) {{{2 |
|
904 | 923 | function! s:HGVimDiff(...) |
|
905 |
let originalBuffer = |
|
|
924 | let originalBuffer = <SID>HGCurrentBufferCheck() | |
|
906 | 925 | let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning + 1 |
|
907 | 926 | try |
|
908 | 927 | " If there's already a VimDiff'ed window, restore it. |
@@ -910,16 +929,16 b' function! s:HGVimDiff(...)' | |||
|
910 | 929 | |
|
911 | 930 | if exists("s:vimDiffSourceBuffer") && s:vimDiffSourceBuffer != originalBuffer |
|
912 | 931 | " Clear the existing vimdiff setup by removing the result buffers. |
|
913 |
call |
|
|
932 | call <SID>HGWipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff') | |
|
914 | 933 | endif |
|
915 | 934 | |
|
916 | 935 | " Split and diff |
|
917 | 936 | if(a:0 == 2) |
|
918 | 937 | " Reset the vimdiff system, as 2 explicit versions were provided. |
|
919 | 938 | if exists('s:vimDiffSourceBuffer') |
|
920 |
call |
|
|
939 | call <SID>HGWipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff') | |
|
921 | 940 | endif |
|
922 |
let resultBuffer = |
|
|
941 | let resultBuffer = <SID>HGReview(a:1) | |
|
923 | 942 | if resultBuffer < 0 |
|
924 | 943 | echomsg "Can't open HG revision " . a:1 |
|
925 | 944 | return resultBuffer |
@@ -930,10 +949,10 b' function! s:HGVimDiff(...)' | |||
|
930 | 949 | let s:vimDiffScratchList = '{'. resultBuffer . '}' |
|
931 | 950 | " If no split method is defined, cheat, and set it to vertical. |
|
932 | 951 | try |
|
933 |
call |
|
|
934 |
let resultBuffer= |
|
|
952 | call <SID>HGOverrideOption('HGCommandSplit', <SID>HGGetOption('HGCommandDiffSplit', <SID>HGGetOption('HGCommandSplit', 'vertical'))) | |
|
953 | let resultBuffer=<SID>HGReview(a:2) | |
|
935 | 954 | finally |
|
936 |
call |
|
|
955 | call <SID>HGOverrideOption('HGCommandSplit') | |
|
937 | 956 | endtry |
|
938 | 957 | if resultBuffer < 0 |
|
939 | 958 | echomsg "Can't open HG revision " . a:1 |
@@ -947,16 +966,16 b' function! s:HGVimDiff(...)' | |||
|
947 | 966 | " Add new buffer |
|
948 | 967 | try |
|
949 | 968 | " Force splitting behavior, otherwise why use vimdiff? |
|
950 |
call |
|
|
951 |
call |
|
|
969 | call <SID>HGOverrideOption("HGCommandEdit", "split") | |
|
970 | call <SID>HGOverrideOption("HGCommandSplit", <SID>HGGetOption('HGCommandDiffSplit', <SID>HGGetOption('HGCommandSplit', 'vertical'))) | |
|
952 | 971 | if(a:0 == 0) |
|
953 |
let resultBuffer= |
|
|
972 | let resultBuffer=<SID>HGReview() | |
|
954 | 973 | else |
|
955 |
let resultBuffer= |
|
|
974 | let resultBuffer=<SID>HGReview(a:1) | |
|
956 | 975 | endif |
|
957 | 976 | finally |
|
958 |
call |
|
|
959 |
call |
|
|
977 | call <SID>HGOverrideOption("HGCommandEdit") | |
|
978 | call <SID>HGOverrideOption("HGCommandSplit") | |
|
960 | 979 | endtry |
|
961 | 980 | if resultBuffer < 0 |
|
962 | 981 | echomsg "Can't open current HG revision" |
@@ -975,14 +994,14 b' function! s:HGVimDiff(...)' | |||
|
975 | 994 | wincmd W |
|
976 | 995 | execute 'buffer' originalBuffer |
|
977 | 996 | " Store info for later original buffer restore |
|
978 |
let s:vimDiffRestoreCmd = |
|
|
997 | let s:vimDiffRestoreCmd = | |
|
979 | 998 | \ "call setbufvar(".originalBuffer.", \"&diff\", ".getbufvar(originalBuffer, '&diff').")" |
|
980 | 999 | \ . "|call setbufvar(".originalBuffer.", \"&foldcolumn\", ".getbufvar(originalBuffer, '&foldcolumn').")" |
|
981 | 1000 | \ . "|call setbufvar(".originalBuffer.", \"&foldenable\", ".getbufvar(originalBuffer, '&foldenable').")" |
|
982 | 1001 | \ . "|call setbufvar(".originalBuffer.", \"&foldmethod\", '".getbufvar(originalBuffer, '&foldmethod')."')" |
|
983 | 1002 | \ . "|call setbufvar(".originalBuffer.", \"&scrollbind\", ".getbufvar(originalBuffer, '&scrollbind').")" |
|
984 | 1003 | \ . "|call setbufvar(".originalBuffer.", \"&wrap\", ".getbufvar(originalBuffer, '&wrap').")" |
|
985 | \ . "|if &foldmethod=='manual'|execute 'normal zE'|endif" | |
|
1004 | \ . "|if &foldmethod=='manual'|execute 'normal! zE'|endif" | |
|
986 | 1005 | diffthis |
|
987 | 1006 | wincmd w |
|
988 | 1007 | else |
@@ -1012,17 +1031,17 b' endfunction' | |||
|
1012 | 1031 | |
|
1013 | 1032 | " Section: Command definitions {{{1 |
|
1014 | 1033 | " Section: Primary commands {{{2 |
|
1015 |
com! HGAdd call |
|
|
1016 |
com! -nargs=? HGAnnotate call |
|
|
1017 |
com! -bang -nargs=? HGCommit call |
|
|
1018 |
com! -nargs=* HGDiff call |
|
|
1019 |
com! -bang HGGotoOriginal call |
|
|
1020 |
com! -nargs=? HGLog call |
|
|
1021 |
com! HGRevert call |
|
|
1022 |
com! -nargs=? HGReview call |
|
|
1023 |
com! HGStatus call |
|
|
1024 |
com! HGUpdate call |
|
|
1025 |
com! -nargs=* HGVimDiff call |
|
|
1034 | com! HGAdd call <SID>HGAdd() | |
|
1035 | com! -nargs=? HGAnnotate call <SID>HGAnnotate(<f-args>) | |
|
1036 | com! -bang -nargs=? HGCommit call <SID>HGCommit(<q-bang>, <q-args>) | |
|
1037 | com! -nargs=* HGDiff call <SID>HGDiff(<f-args>) | |
|
1038 | com! -bang HGGotoOriginal call <SID>HGGotoOriginal(<q-bang>) | |
|
1039 | com! -nargs=? HGLog call <SID>HGLog(<f-args>) | |
|
1040 | com! HGRevert call <SID>HGRevert() | |
|
1041 | com! -nargs=? HGReview call <SID>HGReview(<f-args>) | |
|
1042 | com! HGStatus call <SID>HGStatus() | |
|
1043 | com! HGUpdate call <SID>HGUpdate() | |
|
1044 | com! -nargs=* HGVimDiff call <SID>HGVimDiff(<f-args>) | |
|
1026 | 1045 | |
|
1027 | 1046 | " Section: HG buffer management commands {{{2 |
|
1028 | 1047 | com! HGDisableBufferSetup call HGDisableBufferSetup() |
@@ -1158,7 +1177,7 b' endfunction' | |||
|
1158 | 1177 | |
|
1159 | 1178 | augroup HGVimDiffRestore |
|
1160 | 1179 | au! |
|
1161 |
au BufUnload * call |
|
|
1180 | au BufUnload * call <SID>HGVimDiffRestore(expand("<abuf>")) | |
|
1162 | 1181 | augroup END |
|
1163 | 1182 | |
|
1164 | 1183 | " Section: Optional activation of buffer management {{{1 |
@@ -1168,23 +1187,24 b" if s:HGGetOption('HGCommandEnableBufferS" | |||
|
1168 | 1187 | endif |
|
1169 | 1188 | |
|
1170 | 1189 | " Section: Doc installation {{{1 |
|
1171 | " | |
|
1172 | let s:revision="0.1" | |
|
1173 | if s:HGInstallDocumentation(escape(expand('<sfile>:p'), ' '), s:revision) | |
|
1174 | echom expand('<sfile>:t:r') . ' v' . s:revision . | |
|
1175 | \ ': Help-documentation installed.' | |
|
1176 | endif | |
|
1177 | 1190 | |
|
1178 | " delete one-time vars and functions | |
|
1179 | delfunction <SID>HGInstallDocumentation | |
|
1180 | delfunction <SID>HGFlexiMkdir | |
|
1181 | unlet s:revision | |
|
1182 | ||
|
1191 | if <SID>HGInstallDocumentation(expand("<sfile>:p")) | |
|
1192 | echomsg s:script_name s:script_version . ": updated documentation" | |
|
1193 | endif | |
|
1183 | 1194 | |
|
1184 | 1195 | " Section: Plugin completion {{{1 |
|
1185 | 1196 | |
|
1197 | " delete one-time vars and functions | |
|
1198 | delfunction <SID>HGInstallDocumentation | |
|
1199 | delfunction <SID>HGFlexiMkdir | |
|
1200 | delfunction <SID>HGCleanupOnFailure | |
|
1201 | unlet s:script_version s:script_name | |
|
1202 | ||
|
1186 | 1203 | let loaded_hgcommand=2 |
|
1187 | 1204 | silent do HGCommand User HGPluginFinish |
|
1205 | ||
|
1206 | let &cpo = s:save_cpo | |
|
1207 | unlet s:save_cpo | |
|
1188 | 1208 | " vim:se expandtab sts=2 sw=2: |
|
1189 | 1209 | finish |
|
1190 | 1210 | |
@@ -1216,16 +1236,16 b' 1. Contents\t\t\t\t\t\t *hgcommand-contents*' | |||
|
1216 | 1236 | ============================================================================== |
|
1217 | 1237 | 2. HGCommand Installation *hgcommand-install* |
|
1218 | 1238 | |
|
1219 |
In order to install the plugin, place the hgcommand.vim file into a plugin' |
|
|
1220 |
directory in your runtime path (please see |add-global-plugin| and |
|
|
1239 | In order to install the plugin, place the hgcommand.vim file into a plugin' | |
|
1240 | directory in your runtime path (please see |add-global-plugin| and | |
|
1221 | 1241 | |'runtimepath'|. |
|
1222 | 1242 | |
|
1223 |
HGCommand may be customized by setting variables, creating maps, and |
|
|
1243 | HGCommand may be customized by setting variables, creating maps, and | |
|
1224 | 1244 | specifying event handlers. Please see |hgcommand-customize| for more |
|
1225 | 1245 | details. |
|
1226 | 1246 | |
|
1227 | 1247 | *hgcommand-auto-help* |
|
1228 |
The help file is automagically generated when the |hgcommand| script is |
|
|
1248 | The help file is automagically generated when the |hgcommand| script is | |
|
1229 | 1249 | loaded for the first time. |
|
1230 | 1250 | |
|
1231 | 1251 | ============================================================================== |
@@ -1233,32 +1253,32 b' 2. HGCommand Installation\t\t\t\t *hgcomma' | |||
|
1233 | 1253 | 3. HGCommand Intro *hgcommand* |
|
1234 | 1254 | *hgcommand-intro* |
|
1235 | 1255 | |
|
1236 |
The HGCommand plugin provides global ex commands for manipulating |
|
|
1237 |
HG-controlled source files. In general, each command operates on the |
|
|
1238 |
current buffer and accomplishes a separate hg function, such as update, |
|
|
1256 | The HGCommand plugin provides global ex commands for manipulating | |
|
1257 | HG-controlled source files. In general, each command operates on the | |
|
1258 | current buffer and accomplishes a separate hg function, such as update, | |
|
1239 | 1259 | commit, log, and others (please see |hgcommand-commands| for a list of all |
|
1240 |
available commands). The results of each operation are displayed in a |
|
|
1241 |
scratch buffer. Several buffer variables are defined for those scratch |
|
|
1260 | available commands). The results of each operation are displayed in a | |
|
1261 | scratch buffer. Several buffer variables are defined for those scratch | |
|
1242 | 1262 | buffers (please see |hgcommand-buffer-variables|). |
|
1243 | 1263 | |
|
1244 |
The notion of "current file" means either the current buffer, or, in the |
|
|
1264 | The notion of "current file" means either the current buffer, or, in the | |
|
1245 | 1265 | case of a directory buffer, the file on the current line within the buffer. |
|
1246 | 1266 | |
|
1247 |
For convenience, any HGCommand invoked on a HGCommand scratch buffer acts |
|
|
1248 |
as though it was invoked on the original file and splits the screen so that |
|
|
1267 | For convenience, any HGCommand invoked on a HGCommand scratch buffer acts | |
|
1268 | as though it was invoked on the original file and splits the screen so that | |
|
1249 | 1269 | the output appears in a new window. |
|
1250 | 1270 | |
|
1251 |
Many of the commands accept revisions as arguments. By default, most |
|
|
1252 |
operate on the most recent revision on the current branch if no revision is |
|
|
1271 | Many of the commands accept revisions as arguments. By default, most | |
|
1272 | operate on the most recent revision on the current branch if no revision is | |
|
1253 | 1273 | specified (though see |HGCommandInteractive| to prompt instead). |
|
1254 | 1274 | |
|
1255 |
Each HGCommand is mapped to a key sequence starting with the <Leader> |
|
|
1256 |
keystroke. The default mappings may be overridden by supplying different |
|
|
1257 |
mappings before the plugin is loaded, such as in the vimrc, in the standard |
|
|
1258 |
fashion for plugin mappings. For examples, please see |
|
|
1275 | Each HGCommand is mapped to a key sequence starting with the <Leader> | |
|
1276 | keystroke. The default mappings may be overridden by supplying different | |
|
1277 | mappings before the plugin is loaded, such as in the vimrc, in the standard | |
|
1278 | fashion for plugin mappings. For examples, please see | |
|
1259 | 1279 | |hgcommand-mappings-override|. |
|
1260 | 1280 | |
|
1261 |
The HGCommand plugin may be configured in several ways. For more details, |
|
|
1281 | The HGCommand plugin may be configured in several ways. For more details, | |
|
1262 | 1282 | please see |hgcommand-customize|. |
|
1263 | 1283 | |
|
1264 | 1284 | ============================================================================== |
@@ -1282,85 +1302,85 b' 4.1 HGCommand commands\t\t\t\t\t *hgcommand-' | |||
|
1282 | 1302 | |
|
1283 | 1303 | :HGAdd *:HGAdd* |
|
1284 | 1304 | |
|
1285 |
This command performs "hg add" on the current file. Please note, this does |
|
|
1305 | This command performs "hg add" on the current file. Please note, this does | |
|
1286 | 1306 | not commit the newly-added file. |
|
1287 | 1307 | |
|
1288 | 1308 | :HGAnnotate *:HGAnnotate* |
|
1289 | 1309 | |
|
1290 |
This command performs "hg annotate" on the current file. If an argument is |
|
|
1291 |
given, the argument is used as a revision number to display. If not given |
|
|
1292 |
an argument, it uses the most recent version of the file on the current |
|
|
1293 |
branch. Additionally, if the current buffer is a HGAnnotate buffer |
|
|
1310 | This command performs "hg annotate" on the current file. If an argument is | |
|
1311 | given, the argument is used as a revision number to display. If not given | |
|
1312 | an argument, it uses the most recent version of the file on the current | |
|
1313 | branch. Additionally, if the current buffer is a HGAnnotate buffer | |
|
1294 | 1314 | already, the version number on the current line is used. |
|
1295 | 1315 | |
|
1296 |
If the |HGCommandAnnotateParent| variable is set to a non-zero value, the |
|
|
1297 |
version previous to the one on the current line is used instead. This |
|
|
1316 | If the |HGCommandAnnotateParent| variable is set to a non-zero value, the | |
|
1317 | version previous to the one on the current line is used instead. This | |
|
1298 | 1318 | allows one to navigate back to examine the previous version of a line. |
|
1299 | 1319 | |
|
1300 |
The filetype of the HGCommand scratch buffer is set to 'HGAnnotate', to |
|
|
1320 | The filetype of the HGCommand scratch buffer is set to 'HGAnnotate', to | |
|
1301 | 1321 | take advantage of the bundled syntax file. |
|
1302 | 1322 | |
|
1303 | 1323 | |
|
1304 | 1324 | :HGCommit[!] *:HGCommit* |
|
1305 | 1325 | |
|
1306 |
If called with arguments, this performs "hg commit" using the arguments as |
|
|
1326 | If called with arguments, this performs "hg commit" using the arguments as | |
|
1307 | 1327 | the log message. |
|
1308 | 1328 | |
|
1309 | 1329 | If '!' is used with no arguments, an empty log message is committed. |
|
1310 | 1330 | |
|
1311 |
If called with no arguments, this is a two-step command. The first step |
|
|
1312 |
opens a buffer to accept a log message. When that buffer is written, it is |
|
|
1313 |
automatically closed and the file is committed using the information from |
|
|
1314 |
that log message. The commit can be abandoned if the log message buffer is |
|
|
1331 | If called with no arguments, this is a two-step command. The first step | |
|
1332 | opens a buffer to accept a log message. When that buffer is written, it is | |
|
1333 | automatically closed and the file is committed using the information from | |
|
1334 | that log message. The commit can be abandoned if the log message buffer is | |
|
1315 | 1335 | deleted or wiped before being written. |
|
1316 | 1336 | |
|
1317 |
Alternatively, the mapping that is used to invoke :HGCommit (by default |
|
|
1318 |
<Leader>hgc) can be used in the log message buffer to immediately commit. |
|
|
1319 |
This is useful if the |HGCommandCommitOnWrite| variable is set to 0 to |
|
|
1337 | Alternatively, the mapping that is used to invoke :HGCommit (by default | |
|
1338 | <Leader>hgc) can be used in the log message buffer to immediately commit. | |
|
1339 | This is useful if the |HGCommandCommitOnWrite| variable is set to 0 to | |
|
1320 | 1340 | disable the normal commit-on-write behavior. |
|
1321 | 1341 | |
|
1322 | 1342 | :HGDiff *:HGDiff* |
|
1323 | 1343 | |
|
1324 |
With no arguments, this performs "hg diff" on the current file against the |
|
|
1344 | With no arguments, this performs "hg diff" on the current file against the | |
|
1325 | 1345 | current repository version. |
|
1326 | 1346 | |
|
1327 |
With one argument, "hg diff" is performed on the current file against the |
|
|
1347 | With one argument, "hg diff" is performed on the current file against the | |
|
1328 | 1348 | specified revision. |
|
1329 | 1349 | |
|
1330 |
With two arguments, hg diff is performed between the specified revisions of |
|
|
1350 | With two arguments, hg diff is performed between the specified revisions of | |
|
1331 | 1351 | the current file. |
|
1332 | 1352 | |
|
1333 |
This command uses the 'HGCommandDiffOpt' variable to specify diff options. |
|
|
1334 |
If that variable does not exist, then 'wbBc' is assumed. If you wish to |
|
|
1353 | This command uses the 'HGCommandDiffOpt' variable to specify diff options. | |
|
1354 | If that variable does not exist, then 'wbBc' is assumed. If you wish to | |
|
1335 | 1355 | have no options, then set it to the empty string. |
|
1336 | 1356 | |
|
1337 | 1357 | |
|
1338 | 1358 | :HGGotoOriginal *:HGGotoOriginal* |
|
1339 | 1359 | |
|
1340 |
This command returns the current window to the source buffer, if the |
|
|
1360 | This command returns the current window to the source buffer, if the | |
|
1341 | 1361 | current buffer is a HG command output buffer. |
|
1342 | 1362 | |
|
1343 | 1363 | :HGGotoOriginal! |
|
1344 | 1364 | |
|
1345 |
Like ":HGGotoOriginal" but also executes :bufwipeout on all HG command |
|
|
1365 | Like ":HGGotoOriginal" but also executes :bufwipeout on all HG command | |
|
1346 | 1366 | output buffers for the source buffer. |
|
1347 | 1367 | |
|
1348 | 1368 | :HGLog *:HGLog* |
|
1349 | 1369 | |
|
1350 | 1370 | Performs "hg log" on the current file. |
|
1351 | 1371 | |
|
1352 |
If an argument is given, it is passed as an argument to the "-r" option of |
|
|
1372 | If an argument is given, it is passed as an argument to the "-r" option of | |
|
1353 | 1373 | "hg log". |
|
1354 | 1374 | |
|
1355 | 1375 | :HGRevert *:HGRevert* |
|
1356 | 1376 | |
|
1357 |
Replaces the current file with the most recent version from the repository |
|
|
1377 | Replaces the current file with the most recent version from the repository | |
|
1358 | 1378 | in order to wipe out any undesired changes. |
|
1359 | ||
|
1379 | ||
|
1360 | 1380 | :HGReview *:HGReview* |
|
1361 | 1381 | |
|
1362 |
Retrieves a particular version of the current file. If no argument is |
|
|
1363 |
given, the most recent version of the file on the current branch is |
|
|
1382 | Retrieves a particular version of the current file. If no argument is | |
|
1383 | given, the most recent version of the file on the current branch is | |
|
1364 | 1384 | retrieved. Otherwise, the specified version is retrieved. |
|
1365 | 1385 | |
|
1366 | 1386 | :HGStatus *:HGStatus* |
@@ -1369,37 +1389,37 b' 4.1 HGCommand commands\t\t\t\t\t *hgcommand-' | |||
|
1369 | 1389 | |
|
1370 | 1390 | :HGUpdate *:HGUpdate* |
|
1371 | 1391 | |
|
1372 |
Performs "hg update" on the current file. This intentionally does not |
|
|
1373 |
automatically reload the current buffer, though vim should prompt the user |
|
|
1392 | Performs "hg update" on the current file. This intentionally does not | |
|
1393 | automatically reload the current buffer, though vim should prompt the user | |
|
1374 | 1394 | to do so if the underlying file is altered by this command. |
|
1375 | 1395 | |
|
1376 | 1396 | :HGVimDiff *:HGVimDiff* |
|
1377 | 1397 | |
|
1378 |
With no arguments, this prompts the user for a revision and then uses |
|
|
1379 |
vimdiff to display the differences between the current file and the |
|
|
1380 |
specified revision. If no revision is specified, the most recent version |
|
|
1398 | With no arguments, this prompts the user for a revision and then uses | |
|
1399 | vimdiff to display the differences between the current file and the | |
|
1400 | specified revision. If no revision is specified, the most recent version | |
|
1381 | 1401 | of the file on the current branch is used. |
|
1382 | 1402 | |
|
1383 |
With one argument, that argument is used as the revision as above. With |
|
|
1384 |
two arguments, the differences between the two revisions is displayed using |
|
|
1403 | With one argument, that argument is used as the revision as above. With | |
|
1404 | two arguments, the differences between the two revisions is displayed using | |
|
1385 | 1405 | vimdiff. |
|
1386 | 1406 | |
|
1387 |
With either zero or one argument, the original buffer is used to perform |
|
|
1388 |
the vimdiff. When the other buffer is closed, the original buffer will be |
|
|
1407 | With either zero or one argument, the original buffer is used to perform | |
|
1408 | the vimdiff. When the other buffer is closed, the original buffer will be | |
|
1389 | 1409 | returned to normal mode. |
|
1390 | 1410 | |
|
1391 |
Once vimdiff mode is started using the above methods, additional vimdiff |
|
|
1392 |
buffers may be added by passing a single version argument to the command. |
|
|
1411 | Once vimdiff mode is started using the above methods, additional vimdiff | |
|
1412 | buffers may be added by passing a single version argument to the command. | |
|
1393 | 1413 | There may be up to 4 vimdiff buffers total. |
|
1394 | 1414 | |
|
1395 |
Using the 2-argument form of the command resets the vimdiff to only those 2 |
|
|
1396 |
versions. Additionally, invoking the command on a different file will |
|
|
1415 | Using the 2-argument form of the command resets the vimdiff to only those 2 | |
|
1416 | versions. Additionally, invoking the command on a different file will | |
|
1397 | 1417 | close the previous vimdiff buffers. |
|
1398 | 1418 | |
|
1399 | 1419 | |
|
1400 | 1420 | 4.2 Mappings *hgcommand-mappings* |
|
1401 | 1421 | |
|
1402 |
By default, a mapping is defined for each command. These mappings execute |
|
|
1422 | By default, a mapping is defined for each command. These mappings execute | |
|
1403 | 1423 | the default (no-argument) form of each command. |
|
1404 | 1424 | |
|
1405 | 1425 | <Leader>hga HGAdd |
@@ -1416,20 +1436,20 b' 4.2 Mappings\t\t\t\t\t\t *hgcommand-mappings*' | |||
|
1416 | 1436 | |
|
1417 | 1437 | *hgcommand-mappings-override* |
|
1418 | 1438 | |
|
1419 |
The default mappings can be overriden by user-provided instead by mapping |
|
|
1420 |
to <Plug>CommandName. This is especially useful when these mappings |
|
|
1421 |
collide with other existing mappings (vim will warn of this during plugin |
|
|
1439 | The default mappings can be overriden by user-provided instead by mapping | |
|
1440 | to <Plug>CommandName. This is especially useful when these mappings | |
|
1441 | collide with other existing mappings (vim will warn of this during plugin | |
|
1422 | 1442 | initialization, but will not clobber the existing mappings). |
|
1423 | 1443 | |
|
1424 |
For instance, to override the default mapping for :HGAdd to set it to |
|
|
1444 | For instance, to override the default mapping for :HGAdd to set it to | |
|
1425 | 1445 | '\add', add the following to the vimrc: > |
|
1426 | 1446 | |
|
1427 | 1447 | nmap \add <Plug>HGAdd |
|
1428 | 1448 | < |
|
1429 | 1449 | 4.3 Automatic buffer variables *hgcommand-buffer-variables* |
|
1430 | 1450 | |
|
1431 |
Several buffer variables are defined in each HGCommand result buffer. |
|
|
1432 |
These may be useful for additional customization in callbacks defined in |
|
|
1451 | Several buffer variables are defined in each HGCommand result buffer. | |
|
1452 | These may be useful for additional customization in callbacks defined in | |
|
1433 | 1453 | the event handlers (please see |hgcommand-events|). |
|
1434 | 1454 | |
|
1435 | 1455 | The following variables are automatically defined: |
@@ -1440,24 +1460,24 b' b:hgOrigBuffNR\t\t\t\t\t\t *b:hgOrigBuffN' | |||
|
1440 | 1460 | |
|
1441 | 1461 | b:hgcmd *b:hgcmd* |
|
1442 | 1462 | |
|
1443 |
This variable is set to the name of the hg command that created the result |
|
|
1463 | This variable is set to the name of the hg command that created the result | |
|
1444 | 1464 | buffer. |
|
1445 | 1465 | ============================================================================== |
|
1446 | 1466 | |
|
1447 | 1467 | 5. Configuration and customization *hgcommand-customize* |
|
1448 | 1468 | *hgcommand-config* |
|
1449 | 1469 | |
|
1450 |
The HGCommand plugin can be configured in two ways: by setting |
|
|
1451 |
configuration variables (see |hgcommand-options|) or by defining HGCommand |
|
|
1452 |
event handlers (see |hgcommand-events|). Additionally, the HGCommand |
|
|
1453 |
plugin provides several option for naming the HG result buffers (see |
|
|
1454 |
|hgcommand-naming|) and supported a customized status line (see |
|
|
1470 | The HGCommand plugin can be configured in two ways: by setting | |
|
1471 | configuration variables (see |hgcommand-options|) or by defining HGCommand | |
|
1472 | event handlers (see |hgcommand-events|). Additionally, the HGCommand | |
|
1473 | plugin provides several option for naming the HG result buffers (see | |
|
1474 | |hgcommand-naming|) and supported a customized status line (see | |
|
1455 | 1475 | |hgcommand-statusline| and |hgcommand-buffer-management|). |
|
1456 | 1476 | |
|
1457 | 1477 | 5.1 HGCommand configuration variables *hgcommand-options* |
|
1458 | 1478 | |
|
1459 |
Several variables affect the plugin's behavior. These variables are |
|
|
1460 |
checked at time of execution, and may be defined at the window, buffer, or |
|
|
1479 | Several variables affect the plugin's behavior. These variables are | |
|
1480 | checked at time of execution, and may be defined at the window, buffer, or | |
|
1461 | 1481 | global level and are checked in that order of precedence. |
|
1462 | 1482 | |
|
1463 | 1483 | |
@@ -1478,87 +1498,87 b' 5.1 HGCommand configuration variables\t\t\t' | |||
|
1478 | 1498 | |
|
1479 | 1499 | HGCommandAnnotateParent *HGCommandAnnotateParent* |
|
1480 | 1500 | |
|
1481 |
This variable, if set to a non-zero value, causes the zero-argument form of |
|
|
1482 |
HGAnnotate when invoked on a HGAnnotate buffer to go to the version |
|
|
1483 |
previous to that displayed on the current line. If not set, it defaults to |
|
|
1501 | This variable, if set to a non-zero value, causes the zero-argument form of | |
|
1502 | HGAnnotate when invoked on a HGAnnotate buffer to go to the version | |
|
1503 | previous to that displayed on the current line. If not set, it defaults to | |
|
1484 | 1504 | 0. |
|
1485 | 1505 | |
|
1486 | 1506 | HGCommandCommitOnWrite *HGCommandCommitOnWrite* |
|
1487 | 1507 | |
|
1488 |
This variable, if set to a non-zero value, causes the pending hg commit to |
|
|
1489 |
take place immediately as soon as the log message buffer is written. If |
|
|
1490 |
set to zero, only the HGCommit mapping will cause the pending commit to |
|
|
1508 | This variable, if set to a non-zero value, causes the pending hg commit to | |
|
1509 | take place immediately as soon as the log message buffer is written. If | |
|
1510 | set to zero, only the HGCommit mapping will cause the pending commit to | |
|
1491 | 1511 | occur. If not set, it defaults to 1. |
|
1492 | 1512 | |
|
1493 | 1513 | HGCommandHGExec *HGCommandHGExec* |
|
1494 | 1514 | |
|
1495 |
This variable controls the executable used for all HG commands. If not |
|
|
1515 | This variable controls the executable used for all HG commands. If not | |
|
1496 | 1516 | set, it defaults to "hg". |
|
1497 | 1517 | |
|
1498 | 1518 | HGCommandDeleteOnHide *HGCommandDeleteOnHide* |
|
1499 | 1519 | |
|
1500 |
This variable, if set to a non-zero value, causes the temporary HG result |
|
|
1520 | This variable, if set to a non-zero value, causes the temporary HG result | |
|
1501 | 1521 | buffers to automatically delete themselves when hidden. |
|
1502 | 1522 | |
|
1503 | 1523 | HGCommandDiffOpt *HGCommandDiffOpt* |
|
1504 | 1524 | |
|
1505 |
This variable, if set, determines the options passed to the diff command of |
|
|
1525 | This variable, if set, determines the options passed to the diff command of | |
|
1506 | 1526 | HG. If not set, it defaults to 'w'. |
|
1507 | 1527 | |
|
1508 | 1528 | HGCommandDiffSplit *HGCommandDiffSplit* |
|
1509 | 1529 | |
|
1510 |
This variable overrides the |HGCommandSplit| variable, but only for buffers |
|
|
1530 | This variable overrides the |HGCommandSplit| variable, but only for buffers | |
|
1511 | 1531 | created with |:HGVimDiff|. |
|
1512 | 1532 | |
|
1513 | 1533 | HGCommandEdit *HGCommandEdit* |
|
1514 | 1534 | |
|
1515 |
This variable controls whether the original buffer is replaced ('edit') or |
|
|
1535 | This variable controls whether the original buffer is replaced ('edit') or | |
|
1516 | 1536 | split ('split'). If not set, it defaults to 'edit'. |
|
1517 | 1537 | |
|
1518 | 1538 | HGCommandEnableBufferSetup *HGCommandEnableBufferSetup* |
|
1519 | 1539 | |
|
1520 |
This variable, if set to a non-zero value, activates HG buffer management |
|
|
1521 |
mode see (|hgcommand-buffer-management|). This mode means that three |
|
|
1522 |
buffer variables, 'HGRepository', 'HGRevision' and 'HGBranch', are set if |
|
|
1523 |
the file is HG-controlled. This is useful for displaying version |
|
|
1540 | This variable, if set to a non-zero value, activates HG buffer management | |
|
1541 | mode see (|hgcommand-buffer-management|). This mode means that three | |
|
1542 | buffer variables, 'HGRepository', 'HGRevision' and 'HGBranch', are set if | |
|
1543 | the file is HG-controlled. This is useful for displaying version | |
|
1524 | 1544 | information in the status bar. |
|
1525 | 1545 | |
|
1526 | 1546 | HGCommandInteractive *HGCommandInteractive* |
|
1527 | 1547 | |
|
1528 |
This variable, if set to a non-zero value, causes appropriate commands (for |
|
|
1529 |
the moment, only |:HGReview|) to query the user for a revision to use |
|
|
1548 | This variable, if set to a non-zero value, causes appropriate commands (for | |
|
1549 | the moment, only |:HGReview|) to query the user for a revision to use | |
|
1530 | 1550 | instead of the current revision if none is specified. |
|
1531 | 1551 | |
|
1532 | 1552 | HGCommandNameMarker *HGCommandNameMarker* |
|
1533 | 1553 | |
|
1534 |
This variable, if set, configures the special attention-getting characters |
|
|
1535 |
that appear on either side of the hg buffer type in the buffer name. This |
|
|
1536 |
has no effect unless |HGCommandNameResultBuffers| is set to a true value. |
|
|
1537 |
If not set, it defaults to '_'. |
|
|
1554 | This variable, if set, configures the special attention-getting characters | |
|
1555 | that appear on either side of the hg buffer type in the buffer name. This | |
|
1556 | has no effect unless |HGCommandNameResultBuffers| is set to a true value. | |
|
1557 | If not set, it defaults to '_'. | |
|
1538 | 1558 | |
|
1539 | 1559 | HGCommandNameResultBuffers *HGCommandNameResultBuffers* |
|
1540 | 1560 | |
|
1541 |
This variable, if set to a true value, causes the hg result buffers to be |
|
|
1542 |
named in the old way ('<source file name> _<hg command>_'). If not set or |
|
|
1561 | This variable, if set to a true value, causes the hg result buffers to be | |
|
1562 | named in the old way ('<source file name> _<hg command>_'). If not set or | |
|
1543 | 1563 | set to a false value, the result buffer is nameless. |
|
1544 | 1564 | |
|
1545 | 1565 | HGCommandSplit *HGCommandSplit* |
|
1546 | 1566 | |
|
1547 |
This variable controls the orientation of the various window splits that |
|
|
1548 |
may occur (such as with HGVimDiff, when using a HG command on a HG command |
|
|
1549 |
buffer, or when the |HGCommandEdit| variable is set to 'split'. If set to |
|
|
1550 |
'horizontal', the resulting windows will be on stacked on top of one |
|
|
1551 |
another. If set to 'vertical', the resulting windows will be side-by-side. |
|
|
1567 | This variable controls the orientation of the various window splits that | |
|
1568 | may occur (such as with HGVimDiff, when using a HG command on a HG command | |
|
1569 | buffer, or when the |HGCommandEdit| variable is set to 'split'. If set to | |
|
1570 | 'horizontal', the resulting windows will be on stacked on top of one | |
|
1571 | another. If set to 'vertical', the resulting windows will be side-by-side. | |
|
1552 | 1572 | If not set, it defaults to 'horizontal' for all but HGVimDiff windows. |
|
1553 | 1573 | |
|
1554 | 1574 | 5.2 HGCommand events *hgcommand-events* |
|
1555 | 1575 | |
|
1556 |
For additional customization, HGCommand can trigger user-defined events. |
|
|
1557 |
Event handlers are provided by defining User event autocommands (see |
|
|
1558 |
|autocommand|, |User|) in the HGCommand group with patterns matching the |
|
|
1576 | For additional customization, HGCommand can trigger user-defined events. | |
|
1577 | Event handlers are provided by defining User event autocommands (see | |
|
1578 | |autocommand|, |User|) in the HGCommand group with patterns matching the | |
|
1559 | 1579 | event name. |
|
1560 | 1580 | |
|
1561 |
For instance, the following could be added to the vimrc to provide a 'q' |
|
|
1581 | For instance, the following could be added to the vimrc to provide a 'q' | |
|
1562 | 1582 | mapping to quit a HGCommand scratch buffer: > |
|
1563 | 1583 | |
|
1564 | 1584 | augroup HGCommand |
@@ -1570,10 +1590,10 b' 5.2 HGCommand events\t\t\t\t *hgc' | |||
|
1570 | 1590 | The following hooks are available: |
|
1571 | 1591 | |
|
1572 | 1592 | HGBufferCreated This event is fired just after a hg command result |
|
1573 |
buffer is created and filled with the result of a hg |
|
|
1574 |
command. It is executed within the context of the HG |
|
|
1575 |
command buffer. The HGCommand buffer variables may be |
|
|
1576 |
useful for handlers of this event (please see |
|
|
1593 | buffer is created and filled with the result of a hg | |
|
1594 | command. It is executed within the context of the HG | |
|
1595 | command buffer. The HGCommand buffer variables may be | |
|
1596 | useful for handlers of this event (please see | |
|
1577 | 1597 | |hgcommand-buffer-variables|). |
|
1578 | 1598 | |
|
1579 | 1599 | HGBufferSetup This event is fired just after HG buffer setup occurs, |
@@ -1586,50 +1606,50 b' HGPluginFinish\t\tThis event is fired just' | |||
|
1586 | 1606 | loads. |
|
1587 | 1607 | |
|
1588 | 1608 | HGVimDiffFinish This event is fired just after the HGVimDiff command |
|
1589 |
executes to allow customization of, for instance, |
|
|
1609 | executes to allow customization of, for instance, | |
|
1590 | 1610 | window placement and focus. |
|
1591 | 1611 | |
|
1592 | 1612 | 5.3 HGCommand buffer naming *hgcommand-naming* |
|
1593 | 1613 | |
|
1594 |
By default, the buffers containing the result of HG commands are nameless |
|
|
1595 |
scratch buffers. It is intended that buffer variables of those buffers be |
|
|
1596 |
used to customize the statusline option so that the user may fully control |
|
|
1614 | By default, the buffers containing the result of HG commands are nameless | |
|
1615 | scratch buffers. It is intended that buffer variables of those buffers be | |
|
1616 | used to customize the statusline option so that the user may fully control | |
|
1597 | 1617 | the display of result buffers. |
|
1598 | 1618 | |
|
1599 |
If the old-style naming is desired, please enable the |
|
|
1600 |
|HGCommandNameResultBuffers| variable. Then, each result buffer will |
|
|
1601 |
receive a unique name that includes the source file name, the HG command, |
|
|
1602 |
and any extra data (such as revision numbers) that were part of the |
|
|
1619 | If the old-style naming is desired, please enable the | |
|
1620 | |HGCommandNameResultBuffers| variable. Then, each result buffer will | |
|
1621 | receive a unique name that includes the source file name, the HG command, | |
|
1622 | and any extra data (such as revision numbers) that were part of the | |
|
1603 | 1623 | command. |
|
1604 | 1624 | |
|
1605 | 1625 | 5.4 HGCommand status line support *hgcommand-statusline* |
|
1606 | 1626 | |
|
1607 |
It is intended that the user will customize the |'statusline'| option to |
|
|
1608 |
include HG result buffer attributes. A sample function that may be used in |
|
|
1609 |
the |'statusline'| option is provided by the plugin, HGGetStatusLine(). In |
|
|
1610 |
order to use that function in the status line, do something like the |
|
|
1627 | It is intended that the user will customize the |'statusline'| option to | |
|
1628 | include HG result buffer attributes. A sample function that may be used in | |
|
1629 | the |'statusline'| option is provided by the plugin, HGGetStatusLine(). In | |
|
1630 | order to use that function in the status line, do something like the | |
|
1611 | 1631 | following: > |
|
1612 | 1632 | |
|
1613 | 1633 | set statusline=%<%f\ %{HGGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P |
|
1614 | 1634 | < |
|
1615 | 1635 | of which %{HGGetStatusLine()} is the relevant portion. |
|
1616 | 1636 | |
|
1617 |
The sample HGGetStatusLine() function handles both HG result buffers and |
|
|
1618 |
HG-managed files if HGCommand buffer management is enabled (please see |
|
|
1637 | The sample HGGetStatusLine() function handles both HG result buffers and | |
|
1638 | HG-managed files if HGCommand buffer management is enabled (please see | |
|
1619 | 1639 | |hgcommand-buffer-management|). |
|
1620 | 1640 | |
|
1621 | 1641 | 5.5 HGCommand buffer management *hgcommand-buffer-management* |
|
1622 | 1642 | |
|
1623 |
The HGCommand plugin can operate in buffer management mode, which means |
|
|
1624 |
that it attempts to set two buffer variables ('HGRevision' and 'HGBranch') |
|
|
1625 |
upon entry into a buffer. This is rather slow because it means that 'hg |
|
|
1626 |
status' will be invoked at each entry into a buffer (during the |BufEnter| |
|
|
1643 | The HGCommand plugin can operate in buffer management mode, which means | |
|
1644 | that it attempts to set two buffer variables ('HGRevision' and 'HGBranch') | |
|
1645 | upon entry into a buffer. This is rather slow because it means that 'hg | |
|
1646 | status' will be invoked at each entry into a buffer (during the |BufEnter| | |
|
1627 | 1647 | autocommand). |
|
1628 | 1648 | |
|
1629 |
This mode is enabled by default. In order to disable it, set the |
|
|
1630 |
|HGCommandEnableBufferSetup| variable to a false (zero) value. Enabling |
|
|
1631 |
this mode simply provides the buffer variables mentioned above. The user |
|
|
1632 |
must explicitly include those in the |'statusline'| option if they are to |
|
|
1649 | This mode is enabled by default. In order to disable it, set the | |
|
1650 | |HGCommandEnableBufferSetup| variable to a false (zero) value. Enabling | |
|
1651 | this mode simply provides the buffer variables mentioned above. The user | |
|
1652 | must explicitly include those in the |'statusline'| option if they are to | |
|
1633 | 1653 | appear in the status line (but see |hgcommand-statusline| for a simple way |
|
1634 | 1654 | to do that). |
|
1635 | 1655 | |
@@ -1643,10 +1663,10 b' 9.1 Split window annotation, by Michael ' | |||
|
1643 | 1663 | \:set nowrap<CR> |
|
1644 | 1664 | < |
|
1645 | 1665 | |
|
1646 |
This splits the buffer vertically, puts an annotation on the left (minus |
|
|
1647 |
the header) with the width set to 40. An editable/normal copy is placed on |
|
|
1648 |
the right. The two versions are scroll locked so they move as one. and |
|
|
1649 |
wrapping is turned off so that the lines line up correctly. The advantages |
|
|
1666 | This splits the buffer vertically, puts an annotation on the left (minus | |
|
1667 | the header) with the width set to 40. An editable/normal copy is placed on | |
|
1668 | the right. The two versions are scroll locked so they move as one. and | |
|
1669 | wrapping is turned off so that the lines line up correctly. The advantages | |
|
1650 | 1670 | are... |
|
1651 | 1671 | |
|
1652 | 1672 | 1) You get a versioning on the right. |
@@ -1659,9 +1679,9 b' 8. Known bugs\t\t\t\t\t\t *hgcommand-bugs' | |||
|
1659 | 1679 | |
|
1660 | 1680 | Please let me know if you run across any. |
|
1661 | 1681 | |
|
1662 |
HGVimDiff, when using the original (real) source buffer as one of the diff |
|
|
1663 |
buffers, uses some hacks to try to restore the state of the original buffer |
|
|
1664 |
when the scratch buffer containing the other version is destroyed. There |
|
|
1682 | HGVimDiff, when using the original (real) source buffer as one of the diff | |
|
1683 | buffers, uses some hacks to try to restore the state of the original buffer | |
|
1684 | when the scratch buffer containing the other version is destroyed. There | |
|
1665 | 1685 | may still be bugs in here, depending on many configuration details. |
|
1666 | 1686 | |
|
1667 | 1687 | ============================================================================== |
@@ -1674,4 +1694,4 b' 9. TODO \t\t\t\t\t\t *hgcommand-todo*' | |||
|
1674 | 1694 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
1675 | 1695 | " v im:tw=78:ts=8:ft=help:norl: |
|
1676 | 1696 | " vim600: set foldmethod=marker tabstop=8 shiftwidth=2 softtabstop=2 smartindent smarttab : |
|
1677 |
"fileencoding=iso-8859-15 |
|
|
1697 | "fileencoding=iso-8859-15 |
General Comments 0
You need to be logged in to leave comments.
Login now