author | "Mathieu Clabaut <mathieu.clabaut@gmail.com>" |
Thu, 13 Jul 2006 00:02:26 +0200 | |
changeset 2607 | 070736e20dfd |
parent 2606 | 5cef1a92aa04 |
child 2632 | b1436559f1e9 |
child 2634 | 105708ba518f |
permissions | -rw-r--r-- |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1 |
" vim600: set foldmethod=marker: |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
2 |
" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
3 |
" Vim plugin to assist in working with HG-controlled files. |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
4 |
" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
5 |
" Last Change: 2006/02/22 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
6 |
" Version: 1.76 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
7 |
" Maintainer: Mathieu Clabaut <mathieu.clabaut@gmail.com> |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
8 |
" License: This file is placed in the public domain. |
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
9 |
" Credits: |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
10 |
" Bob Hiestand <bob.hiestand@gmail.com> for the fabulous |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
11 |
" cvscommand.vim from which this script was directly created by |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
12 |
" means of sed commands and minor tweaks. |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
13 |
|
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
14 |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
15 |
" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
16 |
" Section: Documentation |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
17 |
"---------------------------- |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
18 |
" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
19 |
" Documentation should be available by ":help hgcommand" command, once the |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
20 |
" script has been copied in you .vim/plugin directory. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
21 |
" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
22 |
" You still can read the documentation at the end of this file. Locate it by |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
23 |
" searching the "hgcommand-contents" string (and set ft=help to have |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
24 |
" appropriate syntaxic coloration). |
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
25 |
|
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
26 |
" Section: Plugin header {{{1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
27 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
28 |
" loaded_hgcommand is set to 1 when the initialization begins, and 2 when it |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
29 |
" completes. This allows various actions to only be taken by functions after |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
30 |
" system initialization. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
31 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
32 |
if exists("loaded_hgcommand") |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
33 |
finish |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
34 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
35 |
let loaded_hgcommand = 1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
36 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
37 |
if v:version < 602 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
38 |
echohl WarningMsg|echomsg "HGCommand 1.69 or later requires VIM 6.2 or later"|echohl None |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
39 |
finish |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
40 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
41 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
42 |
" Section: Event group setup {{{1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
43 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
44 |
augroup HGCommand |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
45 |
augroup END |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
46 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
47 |
" Section: Plugin initialization {{{1 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
48 |
silent do HGCommand User HGPluginInit |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
49 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
50 |
" Section: Script variable initialization {{{1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
51 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
52 |
let s:HGCommandEditFileRunning = 0 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
53 |
unlet! s:vimDiffRestoreCmd |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
54 |
unlet! s:vimDiffSourceBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
55 |
unlet! s:vimDiffBufferCount |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
56 |
unlet! s:vimDiffScratchList |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
57 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
58 |
" Section: Utility functions {{{1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
59 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
60 |
" Function: s:HGResolveLink() {{{2 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
61 |
" Fully resolve the given file name to remove shortcuts or symbolic links. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
62 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
63 |
function! s:HGResolveLink(fileName) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
64 |
let resolved = resolve(a:fileName) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
65 |
if resolved != a:fileName |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
66 |
let resolved = s:HGResolveLink(resolved) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
67 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
68 |
return resolved |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
69 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
70 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
71 |
" Function: s:HGChangeToCurrentFileDir() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
72 |
" Go to the directory in which the current HG-controlled file is located. |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
73 |
" If this is a HG command buffer, first switch to the original file. |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
74 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
75 |
function! s:HGChangeToCurrentFileDir(fileName) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
76 |
let oldCwd=getcwd() |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
77 |
let fileName=s:HGResolveLink(a:fileName) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
78 |
let newCwd=fnamemodify(fileName, ':h') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
79 |
if strlen(newCwd) > 0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
80 |
execute 'cd' escape(newCwd, ' ') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
81 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
82 |
return oldCwd |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
83 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
84 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
85 |
" Function: s:HGGetOption(name, default) {{{2 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
86 |
" Grab a user-specified option to override the default provided. Options are |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
87 |
" searched in the window, buffer, then global spaces. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
88 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
89 |
function! s:HGGetOption(name, default) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
90 |
if exists("s:" . a:name . "Override") |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
91 |
execute "return s:".a:name."Override" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
92 |
elseif exists("w:" . a:name) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
93 |
execute "return w:".a:name |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
94 |
elseif exists("b:" . a:name) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
95 |
execute "return b:".a:name |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
96 |
elseif exists("g:" . a:name) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
97 |
execute "return g:".a:name |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
98 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
99 |
return a:default |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
100 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
101 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
102 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
103 |
" Function: s:HGEditFile(name, origBuffNR) {{{2 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
104 |
" Wrapper around the 'edit' command to provide some helpful error text if the |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
105 |
" current buffer can't be abandoned. If name is provided, it is used; |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
106 |
" otherwise, a nameless scratch buffer is used. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
107 |
" Returns: 0 if successful, -1 if an error occurs. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
108 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
109 |
function! s:HGEditFile(name, origBuffNR) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
110 |
"Name parameter will be pasted into expression. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
111 |
let name = escape(a:name, ' *?\') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
112 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
113 |
let editCommand = s:HGGetOption('HGCommandEdit', 'edit') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
114 |
if editCommand != 'edit' |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
115 |
if s:HGGetOption('HGCommandSplit', 'horizontal') == 'horizontal' |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
116 |
if name == "" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
117 |
let editCommand = 'rightbelow new' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
118 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
119 |
let editCommand = 'rightbelow split ' . name |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
120 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
121 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
122 |
if name == "" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
123 |
let editCommand = 'vert rightbelow new' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
124 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
125 |
let editCommand = 'vert rightbelow split ' . name |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
126 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
127 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
128 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
129 |
if name == "" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
130 |
let editCommand = 'enew' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
131 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
132 |
let editCommand = 'edit ' . name |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
133 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
134 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
135 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
136 |
" Protect against useless buffer set-up |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
137 |
let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning + 1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
138 |
try |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
139 |
execute editCommand |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
140 |
finally |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
141 |
let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning - 1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
142 |
endtry |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
143 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
144 |
let b:HGOrigBuffNR=a:origBuffNR |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
145 |
let b:HGCommandEdit='split' |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
146 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
147 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
148 |
" Function: s:HGCreateCommandBuffer(cmd, cmdName, statusText, filename) {{{2 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
149 |
" Creates a new scratch buffer and captures the output from execution of the |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
150 |
" given command. The name of the scratch buffer is returned. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
151 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
152 |
function! s:HGCreateCommandBuffer(cmd, cmdName, statusText, origBuffNR) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
153 |
let fileName=bufname(a:origBuffNR) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
154 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
155 |
let resultBufferName='' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
156 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
157 |
if s:HGGetOption("HGCommandNameResultBuffers", 0) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
158 |
let nameMarker = s:HGGetOption("HGCommandNameMarker", '_') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
159 |
if strlen(a:statusText) > 0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
160 |
let bufName=a:cmdName . ' -- ' . a:statusText |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
161 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
162 |
let bufName=a:cmdName |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
163 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
164 |
let bufName=fileName . ' ' . nameMarker . bufName . nameMarker |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
165 |
let counter=0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
166 |
let resultBufferName = bufName |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
167 |
while buflisted(resultBufferName) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
168 |
let counter=counter + 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
169 |
let resultBufferName=bufName . ' (' . counter . ')' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
170 |
endwhile |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
171 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
172 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
173 |
let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " " . a:cmd |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
174 |
echomsg "DBG :".hgCommand |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
175 |
let hgOut = system(hgCommand) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
176 |
" HACK: diff command does not return proper error codes |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
177 |
if v:shell_error && a:cmdName != 'hgdiff' |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
178 |
if strlen(hgOut) == 0 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
179 |
echoerr "HG command failed" |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
180 |
else |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
181 |
echoerr "HG command failed: " . hgOut |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
182 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
183 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
184 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
185 |
if strlen(hgOut) == 0 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
186 |
" Handle case of no output. In this case, it is important to check the |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
187 |
" file status, especially since hg edit/unedit may change the attributes |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
188 |
" of the file with no visible output. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
189 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
190 |
echomsg "No output from HG command" |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
191 |
checktime |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
192 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
193 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
194 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
195 |
if s:HGEditFile(resultBufferName, a:origBuffNR) == -1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
196 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
197 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
198 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
199 |
set buftype=nofile |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
200 |
set noswapfile |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
201 |
set filetype= |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
202 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
203 |
if s:HGGetOption("HGCommandDeleteOnHide", 0) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
204 |
set bufhidden=delete |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
205 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
206 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
207 |
silent 0put=hgOut |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
208 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
209 |
" The last command left a blank line at the end of the buffer. If the |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
210 |
" last line is folded (a side effect of the 'put') then the attempt to |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
211 |
" remove the blank line will kill the last fold. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
212 |
" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
213 |
" This could be fixed by explicitly detecting whether the last line is |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
214 |
" within a fold, but I prefer to simply unfold the result buffer altogether. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
215 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
216 |
if has('folding') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
217 |
normal zR |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
218 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
219 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
220 |
$d |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
221 |
1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
222 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
223 |
" Define the environment and execute user-defined hooks. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
224 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
225 |
let b:HGSourceFile=fileName |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
226 |
let b:HGCommand=a:cmdName |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
227 |
if a:statusText != "" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
228 |
let b:HGStatusText=a:statusText |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
229 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
230 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
231 |
silent do HGCommand User HGBufferCreated |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
232 |
return bufnr("%") |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
233 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
234 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
235 |
" Function: s:HGBufferCheck(hgBuffer) {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
236 |
" Attempts to locate the original file to which HG operations were applied |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
237 |
" for a given buffer. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
238 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
239 |
function! s:HGBufferCheck(hgBuffer) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
240 |
let origBuffer = getbufvar(a:hgBuffer, "HGOrigBuffNR") |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
241 |
if origBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
242 |
if bufexists(origBuffer) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
243 |
return origBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
244 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
245 |
" Original buffer no longer exists. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
246 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
247 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
248 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
249 |
" No original buffer |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
250 |
return a:hgBuffer |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
251 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
252 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
253 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
254 |
" Function: s:HGCurrentBufferCheck() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
255 |
" Attempts to locate the original file to which HG operations were applied |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
256 |
" for the current buffer. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
257 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
258 |
function! s:HGCurrentBufferCheck() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
259 |
return s:HGBufferCheck(bufnr("%")) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
260 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
261 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
262 |
" Function: s:HGToggleDeleteOnHide() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
263 |
" Toggles on and off the delete-on-hide behavior of HG buffers |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
264 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
265 |
function! s:HGToggleDeleteOnHide() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
266 |
if exists("g:HGCommandDeleteOnHide") |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
267 |
unlet g:HGCommandDeleteOnHide |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
268 |
else |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
269 |
let g:HGCommandDeleteOnHide=1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
270 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
271 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
272 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
273 |
" Function: s:HGDoCommand(hgcmd, cmdName, statusText) {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
274 |
" General skeleton for HG function execution. |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
275 |
" Returns: name of the new command buffer containing the command results |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
276 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
277 |
function! s:HGDoCommand(cmd, cmdName, statusText) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
278 |
let hgBufferCheck=s:HGCurrentBufferCheck() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
279 |
if hgBufferCheck == -1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
280 |
echo "Original buffer no longer exists, aborting." |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
281 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
282 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
283 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
284 |
let fileName=bufname(hgBufferCheck) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
285 |
if isdirectory(fileName) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
286 |
let fileName=fileName . "/" . getline(".") |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
287 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
288 |
let realFileName = fnamemodify(s:HGResolveLink(fileName), ':t') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
289 |
let oldCwd=s:HGChangeToCurrentFileDir(fileName) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
290 |
try |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
291 |
" TODO |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
292 |
"if !filereadable('HG/Root') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
293 |
"throw fileName . ' is not a HG-controlled file.' |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
294 |
"endif |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
295 |
let fullCmd = a:cmd . ' "' . realFileName . '"' |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
296 |
"echomsg "DEBUG".fullCmd |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
297 |
let resultBuffer=s:HGCreateCommandBuffer(fullCmd, a:cmdName, a:statusText, hgBufferCheck) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
298 |
return resultBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
299 |
catch |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
300 |
echoerr v:exception |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
301 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
302 |
finally |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
303 |
execute 'cd' escape(oldCwd, ' ') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
304 |
endtry |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
305 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
306 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
307 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
308 |
" Function: s:HGGetStatusVars(revision, branch, repository) {{{2 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
309 |
" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
310 |
" Obtains a HG revision number and branch name. The 'revisionVar', |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
311 |
" 'branchVar'and 'repositoryVar' arguments, if non-empty, contain the names of variables to hold |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
312 |
" the corresponding results. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
313 |
" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
314 |
" Returns: string to be exec'd that sets the multiple return values. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
315 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
316 |
function! s:HGGetStatusVars(revisionVar, branchVar, repositoryVar) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
317 |
let hgBufferCheck=s:HGCurrentBufferCheck() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
318 |
if hgBufferCheck == -1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
319 |
return "" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
320 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
321 |
let fileName=bufname(hgBufferCheck) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
322 |
let realFileName = fnamemodify(s:HGResolveLink(fileName), ':t') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
323 |
let oldCwd=s:HGChangeToCurrentFileDir(fileName) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
324 |
try |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
325 |
""TODO |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
326 |
"if !filereadable('HG/Root') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
327 |
"return "" |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
328 |
"endif |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
329 |
let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " status -mardui " . fileName |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
330 |
let statustext=system(hgCommand) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
331 |
if(v:shell_error) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
332 |
return "" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
333 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
334 |
if match(statustext, '^[?I]') >= 0 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
335 |
let revision="NEW" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
336 |
elseif match(statustext, '^[R]') >= 0 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
337 |
let revision="REMOVED" |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
338 |
elseif match(statustext, '^[D]') >= 0 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
339 |
let revision="DELETED" |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
340 |
elseif match(statustext, '^[A]') >= 0 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
341 |
let revision="ADDED" |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
342 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
343 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
344 |
let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " parents -b " |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
345 |
let statustext=system(hgCommand) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
346 |
if(v:shell_error) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
347 |
return "" |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
348 |
endif |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
349 |
if exists('revision') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
350 |
let returnExpression = "let " . a:revisionVar . "='" . revision . "'" |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
351 |
else |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
352 |
let revision=substitute(statustext, '^changeset:\s*\(\d\+\):.*\_$\_.*$', '\1', "") |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
353 |
let returnExpression = "let " . a:revisionVar . "='" . revision . "'" |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
354 |
endif |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
355 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
356 |
if a:branchVar != "" && match(statustext, '^\_.*\_^branch:') >= 0 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
357 |
let branch=substitute(statustext, '^\_.*\_^branch:\s*\(\S\+\)\n\_.*$', '\1', "") |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
358 |
let returnExpression=returnExpression . " | let " . a:branchVar . "='" . branch . "'" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
359 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
360 |
if a:repositoryVar != "" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
361 |
let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " root " |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
362 |
let roottext=system(hgCommand) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
363 |
let repository=substitute(roottext,'^.*/\([^/\n\r]*\)\n\_.*$','\1','') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
364 |
let returnExpression=returnExpression . " | let " . a:repositoryVar . "='" . repository . "'" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
365 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
366 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
367 |
|
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
368 |
|
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
369 |
return returnExpression |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
370 |
finally |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
371 |
execute 'cd' escape(oldCwd, ' ') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
372 |
endtry |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
373 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
374 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
375 |
" Function: s:HGSetupBuffer() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
376 |
" Attempts to set the b:HGBranch, b:HGRevision and b:HGRepository variables. |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
377 |
|
2607
070736e20dfd
HGcommand.vim : HGCommandEnableBufferSetup on by default
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2606
diff
changeset
|
378 |
function! s:HGSetupBuffer(...) |
070736e20dfd
HGcommand.vim : HGCommandEnableBufferSetup on by default
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2606
diff
changeset
|
379 |
if (exists("b:HGBufferSetup") && b:HGBufferSetup && !exists('a:1')) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
380 |
" This buffer is already set up. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
381 |
return |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
382 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
383 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
384 |
if !s:HGGetOption("HGCommandEnableBufferSetup", 0) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
385 |
\ || @% == "" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
386 |
\ || s:HGCommandEditFileRunning > 0 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
387 |
\ || exists("b:HGOrigBuffNR") |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
388 |
unlet! b:HGRevision |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
389 |
unlet! b:HGBranch |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
390 |
unlet! b:HGRepository |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
391 |
return |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
392 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
393 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
394 |
if !filereadable(expand("%")) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
395 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
396 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
397 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
398 |
let revision="" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
399 |
let branch="" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
400 |
let repository="" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
401 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
402 |
exec s:HGGetStatusVars('revision', 'branch', 'repository') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
403 |
"echomsg "DBG ".revision."#".branch."#".repository |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
404 |
if revision != "" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
405 |
let b:HGRevision=revision |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
406 |
else |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
407 |
unlet! b:HGRevision |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
408 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
409 |
if branch != "" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
410 |
let b:HGBranch=branch |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
411 |
else |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
412 |
unlet! b:HGBranch |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
413 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
414 |
if repository != "" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
415 |
let b:HGRepository=repository |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
416 |
else |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
417 |
unlet! b:HGRepository |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
418 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
419 |
silent do HGCommand User HGBufferSetup |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
420 |
let b:HGBufferSetup=1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
421 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
422 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
423 |
" Function: s:HGMarkOrigBufferForSetup(hgbuffer) {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
424 |
" Resets the buffer setup state of the original buffer for a given HG buffer. |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
425 |
" Returns: The HG buffer number in a passthrough mode. |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
426 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
427 |
function! s:HGMarkOrigBufferForSetup(hgBuffer) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
428 |
checktime |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
429 |
if a:hgBuffer != -1 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
430 |
let origBuffer = s:HGBufferCheck(a:hgBuffer) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
431 |
"This should never not work, but I'm paranoid |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
432 |
if origBuffer != a:hgBuffer |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
433 |
call setbufvar(origBuffer, "HGBufferSetup", 0) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
434 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
435 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
436 |
return a:hgBuffer |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
437 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
438 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
439 |
" Function: s:HGOverrideOption(option, [value]) {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
440 |
" Provides a temporary override for the given HG option. If no value is |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
441 |
" passed, the override is disabled. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
442 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
443 |
function! s:HGOverrideOption(option, ...) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
444 |
if a:0 == 0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
445 |
unlet! s:{a:option}Override |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
446 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
447 |
let s:{a:option}Override = a:1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
448 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
449 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
450 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
451 |
" Function: s:HGWipeoutCommandBuffers() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
452 |
" Clears all current HG buffers of the specified type for a given source. |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
453 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
454 |
function! s:HGWipeoutCommandBuffers(originalBuffer, hgCommand) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
455 |
let buffer = 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
456 |
while buffer <= bufnr('$') |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
457 |
if getbufvar(buffer, 'HGOrigBuffNR') == a:originalBuffer |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
458 |
if getbufvar(buffer, 'HGCommand') == a:hgCommand |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
459 |
execute 'bw' buffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
460 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
461 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
462 |
let buffer = buffer + 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
463 |
endwhile |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
464 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
465 |
|
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
466 |
" Function: s:HGInstallDocumentation(full_name, revision) {{{2 |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
467 |
" Install help documentation. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
468 |
" Arguments: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
469 |
" full_name: Full name of this vim plugin script, including path name. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
470 |
" revision: Revision of the vim script. #version# mark in the document file |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
471 |
" will be replaced with this string with 'v' prefix. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
472 |
" Return: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
473 |
" 1 if new document installed, 0 otherwise. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
474 |
" Note: Cleaned and generalized by guo-peng Wen |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
475 |
"''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
476 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
477 |
function! s:HGInstallDocumentation(full_name, revision) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
478 |
" Name of the document path based on the system we use: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
479 |
if (has("unix")) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
480 |
" On UNIX like system, using forward slash: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
481 |
let l:slash_char = '/' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
482 |
let l:mkdir_cmd = ':silent !mkdir -p ' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
483 |
else |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
484 |
" On M$ system, use backslash. Also mkdir syntax is different. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
485 |
" This should only work on W2K and up. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
486 |
let l:slash_char = '\' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
487 |
let l:mkdir_cmd = ':silent !mkdir ' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
488 |
endif |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
489 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
490 |
let l:doc_path = l:slash_char . 'doc' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
491 |
let l:doc_home = l:slash_char . '.vim' . l:slash_char . 'doc' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
492 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
493 |
" Figure out document path based on full name of this script: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
494 |
let l:vim_plugin_path = fnamemodify(a:full_name, ':h') |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
495 |
let l:vim_doc_path = fnamemodify(a:full_name, ':h:h') . l:doc_path |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
496 |
if (!(filewritable(l:vim_doc_path) == 2)) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
497 |
echomsg "Doc path: " . l:vim_doc_path |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
498 |
execute l:mkdir_cmd . '"' . l:vim_doc_path . '"' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
499 |
if (!(filewritable(l:vim_doc_path) == 2)) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
500 |
" Try a default configuration in user home: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
501 |
let l:vim_doc_path = expand("~") . l:doc_home |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
502 |
if (!(filewritable(l:vim_doc_path) == 2)) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
503 |
execute l:mkdir_cmd . '"' . l:vim_doc_path . '"' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
504 |
if (!(filewritable(l:vim_doc_path) == 2)) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
505 |
" Put a warning: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
506 |
echomsg "Unable to open documentation directory" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
507 |
echomsg " type :help add-local-help for more informations." |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
508 |
return 0 |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
509 |
endif |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
510 |
endif |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
511 |
endif |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
512 |
endif |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
513 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
514 |
" Exit if we have problem to access the document directory: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
515 |
if (!isdirectory(l:vim_plugin_path) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
516 |
\ || !isdirectory(l:vim_doc_path) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
517 |
\ || filewritable(l:vim_doc_path) != 2) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
518 |
return 0 |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
519 |
endif |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
520 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
521 |
" Full name of script and documentation file: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
522 |
let l:script_name = fnamemodify(a:full_name, ':t') |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
523 |
let l:doc_name = fnamemodify(a:full_name, ':t:r') . '.txt' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
524 |
let l:plugin_file = l:vim_plugin_path . l:slash_char . l:script_name |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
525 |
let l:doc_file = l:vim_doc_path . l:slash_char . l:doc_name |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
526 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
527 |
" Bail out if document file is still up to date: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
528 |
if (filereadable(l:doc_file) && |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
529 |
\ getftime(l:plugin_file) < getftime(l:doc_file)) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
530 |
return 0 |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
531 |
endif |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
532 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
533 |
" Prepare window position restoring command: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
534 |
if (strlen(@%)) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
535 |
let l:go_back = 'b ' . bufnr("%") |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
536 |
else |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
537 |
let l:go_back = 'enew!' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
538 |
endif |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
539 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
540 |
" Create a new buffer & read in the plugin file (me): |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
541 |
setl nomodeline |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
542 |
exe 'enew!' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
543 |
exe 'r ' . l:plugin_file |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
544 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
545 |
setl modeline |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
546 |
let l:buf = bufnr("%") |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
547 |
setl noswapfile modifiable |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
548 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
549 |
norm zR |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
550 |
norm gg |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
551 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
552 |
" Delete from first line to a line starts with |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
553 |
" === START_DOC |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
554 |
1,/^=\{3,}\s\+START_DOC\C/ d |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
555 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
556 |
" Delete from a line starts with |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
557 |
" === END_DOC |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
558 |
" to the end of the documents: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
559 |
/^=\{3,}\s\+END_DOC\C/,$ d |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
560 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
561 |
" Remove fold marks: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
562 |
%s/{\{3}[1-9]/ / |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
563 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
564 |
" Add modeline for help doc: the modeline string is mangled intentionally |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
565 |
" to avoid it be recognized by VIM: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
566 |
call append(line('$'), '') |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
567 |
call append(line('$'), ' v' . 'im:tw=78:ts=8:ft=help:norl:') |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
568 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
569 |
" Replace revision: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
570 |
exe "normal :1s/#version#/ v" . a:revision . "/\<CR>" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
571 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
572 |
" Save the help document: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
573 |
exe 'w! ' . l:doc_file |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
574 |
exe l:go_back |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
575 |
exe 'bw ' . l:buf |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
576 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
577 |
" Build help tags: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
578 |
exe 'helptags ' . l:vim_doc_path |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
579 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
580 |
return 1 |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
581 |
endfunction |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
582 |
|
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
583 |
" Section: Public functions {{{1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
584 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
585 |
" Function: HGGetRevision() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
586 |
" Global function for retrieving the current buffer's HG revision number. |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
587 |
" Returns: Revision number or an empty string if an error occurs. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
588 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
589 |
function! HGGetRevision() |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
590 |
let revision="" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
591 |
exec s:HGGetStatusVars('revision', '', '') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
592 |
return revision |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
593 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
594 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
595 |
" Function: HGDisableBufferSetup() {{{2 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
596 |
" Global function for deactivating the buffer autovariables. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
597 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
598 |
function! HGDisableBufferSetup() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
599 |
let g:HGCommandEnableBufferSetup=0 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
600 |
silent! augroup! HGCommandPlugin |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
601 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
602 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
603 |
" Function: HGEnableBufferSetup() {{{2 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
604 |
" Global function for activating the buffer autovariables. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
605 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
606 |
function! HGEnableBufferSetup() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
607 |
let g:HGCommandEnableBufferSetup=1 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
608 |
augroup HGCommandPlugin |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
609 |
au! |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
610 |
au BufEnter * call s:HGSetupBuffer() |
2607
070736e20dfd
HGcommand.vim : HGCommandEnableBufferSetup on by default
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2606
diff
changeset
|
611 |
" Force resetting up buffer on external file change (HG update) |
070736e20dfd
HGcommand.vim : HGCommandEnableBufferSetup on by default
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2606
diff
changeset
|
612 |
au FileChangedShell * call s:HGSetupBuffer(1) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
613 |
augroup END |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
614 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
615 |
" Only auto-load if the plugin is fully loaded. This gives other plugins a |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
616 |
" chance to run. |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
617 |
if g:loaded_hgcommand == 2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
618 |
call s:HGSetupBuffer() |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
619 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
620 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
621 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
622 |
" Function: HGGetStatusLine() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
623 |
" Default (sample) status line entry for HG files. This is only useful if |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
624 |
" HG-managed buffer mode is on (see the HGCommandEnableBufferSetup variable |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
625 |
" for how to do this). |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
626 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
627 |
function! HGGetStatusLine() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
628 |
if exists('b:HGSourceFile') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
629 |
" This is a result buffer |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
630 |
let value='[' . b:HGCommand . ' ' . b:HGSourceFile |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
631 |
if exists('b:HGStatusText') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
632 |
let value=value . ' ' . b:HGStatusText |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
633 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
634 |
let value = value . ']' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
635 |
return value |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
636 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
637 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
638 |
if exists('b:HGRevision') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
639 |
\ && b:HGRevision != '' |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
640 |
\ && exists('b:HGRepository') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
641 |
\ && b:HGRepository != '' |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
642 |
\ && exists('g:HGCommandEnableBufferSetup') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
643 |
\ && g:HGCommandEnableBufferSetup |
2606
5cef1a92aa04
HGcommand.vim : HGGetStatusLine accept to display an empty 'branch' value
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2605
diff
changeset
|
644 |
if !exists('b:HGBranch') |
5cef1a92aa04
HGcommand.vim : HGGetStatusLine accept to display an empty 'branch' value
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2605
diff
changeset
|
645 |
let l:branch='' |
5cef1a92aa04
HGcommand.vim : HGGetStatusLine accept to display an empty 'branch' value
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2605
diff
changeset
|
646 |
else |
5cef1a92aa04
HGcommand.vim : HGGetStatusLine accept to display an empty 'branch' value
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2605
diff
changeset
|
647 |
let l:branch=b:HGBranch |
5cef1a92aa04
HGcommand.vim : HGGetStatusLine accept to display an empty 'branch' value
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2605
diff
changeset
|
648 |
endif |
5cef1a92aa04
HGcommand.vim : HGGetStatusLine accept to display an empty 'branch' value
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2605
diff
changeset
|
649 |
return '[HG ' . b:HGRepository . '/' . l:branch .'/' . b:HGRevision . ']' |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
650 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
651 |
return '' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
652 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
653 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
654 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
655 |
" Section: HG command functions {{{1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
656 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
657 |
" Function: s:HGAdd() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
658 |
function! s:HGAdd() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
659 |
return s:HGMarkOrigBufferForSetup(s:HGDoCommand('add', 'hgadd', '')) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
660 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
661 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
662 |
" Function: s:HGAnnotate(...) {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
663 |
function! s:HGAnnotate(...) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
664 |
if a:0 == 0 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
665 |
if &filetype == "HGAnnotate" |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
666 |
" This is a HGAnnotate buffer. Perform annotation of the version |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
667 |
" indicated by the current line. |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
668 |
let revision = substitute(getline("."),'\(^[0-9]*\):.*','\1','') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
669 |
if s:HGGetOption('HGCommandAnnotateParent', 0) != 0 && revision > 0 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
670 |
let revision = revision - 1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
671 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
672 |
else |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
673 |
let revision=HGGetRevision() |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
674 |
if revision == "" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
675 |
echoerr "Unable to obtain HG version information." |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
676 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
677 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
678 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
679 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
680 |
let revision=a:1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
681 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
682 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
683 |
if revision == "NEW" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
684 |
echo "No annotatation available for new file." |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
685 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
686 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
687 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
688 |
let resultBuffer=s:HGDoCommand('annotate -ndu -r ' . revision, 'hgannotate', revision) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
689 |
echomsg "DBG: ".resultBuffer |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
690 |
if resultBuffer != -1 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
691 |
set filetype=HGAnnotate |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
692 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
693 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
694 |
return resultBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
695 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
696 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
697 |
" Function: s:HGCommit() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
698 |
function! s:HGCommit(...) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
699 |
" Handle the commit message being specified. If a message is supplied, it |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
700 |
" is used; if bang is supplied, an empty message is used; otherwise, the |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
701 |
" user is provided a buffer from which to edit the commit message. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
702 |
if a:2 != "" || a:1 == "!" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
703 |
return s:HGMarkOrigBufferForSetup(s:HGDoCommand('commit -m "' . a:2 . '"', 'hgcommit', '')) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
704 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
705 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
706 |
let hgBufferCheck=s:HGCurrentBufferCheck() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
707 |
if hgBufferCheck == -1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
708 |
echo "Original buffer no longer exists, aborting." |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
709 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
710 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
711 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
712 |
" Protect against windows' backslashes in paths. They confuse exec'd |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
713 |
" commands. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
714 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
715 |
let shellSlashBak = &shellslash |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
716 |
try |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
717 |
set shellslash |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
718 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
719 |
let messageFileName = tempname() |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
720 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
721 |
let fileName=bufname(hgBufferCheck) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
722 |
let realFilePath=s:HGResolveLink(fileName) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
723 |
let newCwd=fnamemodify(realFilePath, ':h') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
724 |
if strlen(newCwd) == 0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
725 |
" Account for autochdir being in effect, which will make this blank, but |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
726 |
" we know we'll be in the current directory for the original file. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
727 |
let newCwd = getcwd() |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
728 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
729 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
730 |
let realFileName=fnamemodify(realFilePath, ':t') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
731 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
732 |
if s:HGEditFile(messageFileName, hgBufferCheck) == -1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
733 |
return |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
734 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
735 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
736 |
" Protect against case and backslash issues in Windows. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
737 |
let autoPattern = '\c' . messageFileName |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
738 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
739 |
" Ensure existance of group |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
740 |
augroup HGCommit |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
741 |
augroup END |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
742 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
743 |
execute 'au HGCommit BufDelete' autoPattern 'call delete("' . messageFileName . '")' |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
744 |
execute 'au HGCommit BufDelete' autoPattern 'au! HGCommit * ' autoPattern |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
745 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
746 |
" Create a commit mapping. The mapping must clear all autocommands in case |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
747 |
" it is invoked when HGCommandCommitOnWrite is active, as well as to not |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
748 |
" invoke the buffer deletion autocommand. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
749 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
750 |
execute 'nnoremap <silent> <buffer> <Plug>HGCommit '. |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
751 |
\ ':au! HGCommit * ' . autoPattern . '<CR>'. |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
752 |
\ ':g/^HG:/d<CR>'. |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
753 |
\ ':update<CR>'. |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
754 |
\ ':call <SID>HGFinishCommit("' . messageFileName . '",' . |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
755 |
\ '"' . newCwd . '",' . |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
756 |
\ '"' . realFileName . '",' . |
2607
070736e20dfd
HGcommand.vim : HGCommandEnableBufferSetup on by default
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2606
diff
changeset
|
757 |
\ hgBufferCheck . ')<CR>'. |
070736e20dfd
HGcommand.vim : HGCommandEnableBufferSetup on by default
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2606
diff
changeset
|
758 |
\ ':call <SID>HGBufferSetup(1)<CR>' |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
759 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
760 |
silent 0put ='HG: ----------------------------------------------------------------------' |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
761 |
silent put =\"HG: Enter Log. Lines beginning with `HG:' are removed automatically\" |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
762 |
silent put ='HG: Type <leader>cc (or your own <Plug>HGCommit mapping)' |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
763 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
764 |
if s:HGGetOption('HGCommandCommitOnWrite', 1) == 1 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
765 |
execute 'au HGCommit BufWritePre' autoPattern 'g/^HG:/d' |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
766 |
execute 'au HGCommit BufWritePost' autoPattern 'call s:HGFinishCommit("' . messageFileName . '", "' . newCwd . '", "' . realFileName . '", ' . hgBufferCheck . ') | au! * ' autoPattern |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
767 |
silent put ='HG: or write this buffer' |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
768 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
769 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
770 |
silent put ='HG: to finish this commit operation' |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
771 |
silent put ='HG: ----------------------------------------------------------------------' |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
772 |
$ |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
773 |
let b:HGSourceFile=fileName |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
774 |
let b:HGCommand='HGCommit' |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
775 |
set filetype=hg |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
776 |
finally |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
777 |
let &shellslash = shellSlashBak |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
778 |
endtry |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
779 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
780 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
781 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
782 |
" Function: s:HGDiff(...) {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
783 |
function! s:HGDiff(...) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
784 |
if a:0 == 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
785 |
let revOptions = '-r' . a:1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
786 |
let caption = a:1 . ' -> current' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
787 |
elseif a:0 == 2 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
788 |
let revOptions = '-r' . a:1 . ' -r' . a:2 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
789 |
let caption = a:1 . ' -> ' . a:2 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
790 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
791 |
let revOptions = '' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
792 |
let caption = '' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
793 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
794 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
795 |
let hgdiffopt=s:HGGetOption('HGCommandDiffOpt', 'w') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
796 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
797 |
if hgdiffopt == "" |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
798 |
let diffoptionstring="" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
799 |
else |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
800 |
let diffoptionstring=" -" . hgdiffopt . " " |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
801 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
802 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
803 |
let resultBuffer = s:HGDoCommand('diff ' . diffoptionstring . revOptions , 'hgdiff', caption) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
804 |
if resultBuffer != -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
805 |
set filetype=diff |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
806 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
807 |
return resultBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
808 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
809 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
810 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
811 |
" Function: s:HGGotoOriginal(["!]) {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
812 |
function! s:HGGotoOriginal(...) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
813 |
let origBuffNR = s:HGCurrentBufferCheck() |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
814 |
if origBuffNR > 0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
815 |
let origWinNR = bufwinnr(origBuffNR) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
816 |
if origWinNR == -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
817 |
execute 'buffer' origBuffNR |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
818 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
819 |
execute origWinNR . 'wincmd w' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
820 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
821 |
if a:0 == 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
822 |
if a:1 == "!" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
823 |
let buffnr = 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
824 |
let buffmaxnr = bufnr("$") |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
825 |
while buffnr <= buffmaxnr |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
826 |
if getbufvar(buffnr, "HGOrigBuffNR") == origBuffNR |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
827 |
execute "bw" buffnr |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
828 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
829 |
let buffnr = buffnr + 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
830 |
endwhile |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
831 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
832 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
833 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
834 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
835 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
836 |
" Function: s:HGFinishCommit(messageFile, targetDir, targetFile) {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
837 |
function! s:HGFinishCommit(messageFile, targetDir, targetFile, origBuffNR) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
838 |
if filereadable(a:messageFile) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
839 |
let oldCwd=getcwd() |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
840 |
if strlen(a:targetDir) > 0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
841 |
execute 'cd' escape(a:targetDir, ' ') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
842 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
843 |
let resultBuffer=s:HGCreateCommandBuffer('commit -F "' . a:messageFile . '" "'. a:targetFile . '"', 'hgcommit', '', a:origBuffNR) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
844 |
execute 'cd' escape(oldCwd, ' ') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
845 |
execute 'bw' escape(a:messageFile, ' *?\') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
846 |
silent execute 'call delete("' . a:messageFile . '")' |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
847 |
return s:HGMarkOrigBufferForSetup(resultBuffer) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
848 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
849 |
echoerr "Can't read message file; no commit is possible." |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
850 |
return -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
851 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
852 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
853 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
854 |
" Function: s:HGLog() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
855 |
function! s:HGLog(...) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
856 |
if a:0 == 0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
857 |
let versionOption = "" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
858 |
let caption = '' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
859 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
860 |
let versionOption=" -r" . a:1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
861 |
let caption = a:1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
862 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
863 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
864 |
let resultBuffer=s:HGDoCommand('log' . versionOption, 'hglog', caption) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
865 |
if resultBuffer != "" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
866 |
set filetype=rcslog |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
867 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
868 |
return resultBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
869 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
870 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
871 |
" Function: s:HGRevert() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
872 |
function! s:HGRevert() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
873 |
return s:HGMarkOrigBufferForSetup(s:HGDoCommand('revert', 'hgrevert', '')) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
874 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
875 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
876 |
" Function: s:HGReview(...) {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
877 |
function! s:HGReview(...) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
878 |
if a:0 == 0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
879 |
let versiontag="" |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
880 |
if s:HGGetOption('HGCommandInteractive', 0) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
881 |
let versiontag=input('Revision: ') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
882 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
883 |
if versiontag == "" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
884 |
let versiontag="(current)" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
885 |
let versionOption="" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
886 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
887 |
let versionOption=" -r " . versiontag . " " |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
888 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
889 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
890 |
let versiontag=a:1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
891 |
let versionOption=" -r " . versiontag . " " |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
892 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
893 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
894 |
let resultBuffer = s:HGDoCommand('cat' . versionOption, 'hgreview', versiontag) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
895 |
if resultBuffer > 0 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
896 |
let &filetype=getbufvar(b:HGOrigBuffNR, '&filetype') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
897 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
898 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
899 |
return resultBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
900 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
901 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
902 |
" Function: s:HGStatus() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
903 |
function! s:HGStatus() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
904 |
return s:HGDoCommand('status', 'hgstatus', '') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
905 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
906 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
907 |
|
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
908 |
" Function: s:HGUpdate() {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
909 |
function! s:HGUpdate() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
910 |
return s:HGMarkOrigBufferForSetup(s:HGDoCommand('update', 'update', '')) |
2607
070736e20dfd
HGcommand.vim : HGCommandEnableBufferSetup on by default
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2606
diff
changeset
|
911 |
call s:HGSetupBuffer(1) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
912 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
913 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
914 |
" Function: s:HGVimDiff(...) {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
915 |
function! s:HGVimDiff(...) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
916 |
let originalBuffer = s:HGCurrentBufferCheck() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
917 |
let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning + 1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
918 |
try |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
919 |
" If there's already a VimDiff'ed window, restore it. |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
920 |
" There may only be one HGVimDiff original window at a time. |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
921 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
922 |
if exists("s:vimDiffSourceBuffer") && s:vimDiffSourceBuffer != originalBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
923 |
" Clear the existing vimdiff setup by removing the result buffers. |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
924 |
call s:HGWipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
925 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
926 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
927 |
" Split and diff |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
928 |
if(a:0 == 2) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
929 |
" Reset the vimdiff system, as 2 explicit versions were provided. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
930 |
if exists('s:vimDiffSourceBuffer') |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
931 |
call s:HGWipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
932 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
933 |
let resultBuffer = s:HGReview(a:1) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
934 |
if resultBuffer < 0 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
935 |
echomsg "Can't open HG revision " . a:1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
936 |
return resultBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
937 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
938 |
let b:HGCommand = 'vimdiff' |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
939 |
diffthis |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
940 |
let s:vimDiffBufferCount = 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
941 |
let s:vimDiffScratchList = '{'. resultBuffer . '}' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
942 |
" If no split method is defined, cheat, and set it to vertical. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
943 |
try |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
944 |
call s:HGOverrideOption('HGCommandSplit', s:HGGetOption('HGCommandDiffSplit', s:HGGetOption('HGCommandSplit', 'vertical'))) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
945 |
let resultBuffer=s:HGReview(a:2) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
946 |
finally |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
947 |
call s:HGOverrideOption('HGCommandSplit') |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
948 |
endtry |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
949 |
if resultBuffer < 0 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
950 |
echomsg "Can't open HG revision " . a:1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
951 |
return resultBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
952 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
953 |
let b:HGCommand = 'vimdiff' |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
954 |
diffthis |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
955 |
let s:vimDiffBufferCount = 2 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
956 |
let s:vimDiffScratchList = s:vimDiffScratchList . '{'. resultBuffer . '}' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
957 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
958 |
" Add new buffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
959 |
try |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
960 |
" Force splitting behavior, otherwise why use vimdiff? |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
961 |
call s:HGOverrideOption("HGCommandEdit", "split") |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
962 |
call s:HGOverrideOption("HGCommandSplit", s:HGGetOption('HGCommandDiffSplit', s:HGGetOption('HGCommandSplit', 'vertical'))) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
963 |
if(a:0 == 0) |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
964 |
let resultBuffer=s:HGReview() |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
965 |
else |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
966 |
let resultBuffer=s:HGReview(a:1) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
967 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
968 |
finally |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
969 |
call s:HGOverrideOption("HGCommandEdit") |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
970 |
call s:HGOverrideOption("HGCommandSplit") |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
971 |
endtry |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
972 |
if resultBuffer < 0 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
973 |
echomsg "Can't open current HG revision" |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
974 |
return resultBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
975 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
976 |
let b:HGCommand = 'vimdiff' |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
977 |
diffthis |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
978 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
979 |
if !exists('s:vimDiffBufferCount') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
980 |
" New instance of vimdiff. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
981 |
let s:vimDiffBufferCount = 2 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
982 |
let s:vimDiffScratchList = '{' . resultBuffer . '}' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
983 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
984 |
" This could have been invoked on a HG result buffer, not the |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
985 |
" original buffer. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
986 |
wincmd W |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
987 |
execute 'buffer' originalBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
988 |
" Store info for later original buffer restore |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
989 |
let s:vimDiffRestoreCmd = |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
990 |
\ "call setbufvar(".originalBuffer.", \"&diff\", ".getbufvar(originalBuffer, '&diff').")" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
991 |
\ . "|call setbufvar(".originalBuffer.", \"&foldcolumn\", ".getbufvar(originalBuffer, '&foldcolumn').")" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
992 |
\ . "|call setbufvar(".originalBuffer.", \"&foldenable\", ".getbufvar(originalBuffer, '&foldenable').")" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
993 |
\ . "|call setbufvar(".originalBuffer.", \"&foldmethod\", '".getbufvar(originalBuffer, '&foldmethod')."')" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
994 |
\ . "|call setbufvar(".originalBuffer.", \"&scrollbind\", ".getbufvar(originalBuffer, '&scrollbind').")" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
995 |
\ . "|call setbufvar(".originalBuffer.", \"&wrap\", ".getbufvar(originalBuffer, '&wrap').")" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
996 |
\ . "|if &foldmethod=='manual'|execute 'normal zE'|endif" |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
997 |
diffthis |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
998 |
wincmd w |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
999 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1000 |
" Adding a window to an existing vimdiff |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1001 |
let s:vimDiffBufferCount = s:vimDiffBufferCount + 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1002 |
let s:vimDiffScratchList = s:vimDiffScratchList . '{' . resultBuffer . '}' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1003 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1004 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1005 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1006 |
let s:vimDiffSourceBuffer = originalBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1007 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1008 |
" Avoid executing the modeline in the current buffer after the autocommand. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1009 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1010 |
let currentBuffer = bufnr('%') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1011 |
let saveModeline = getbufvar(currentBuffer, '&modeline') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1012 |
try |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1013 |
call setbufvar(currentBuffer, '&modeline', 0) |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1014 |
silent do HGCommand User HGVimDiffFinish |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1015 |
finally |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1016 |
call setbufvar(currentBuffer, '&modeline', saveModeline) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1017 |
endtry |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1018 |
return resultBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1019 |
finally |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1020 |
let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning - 1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1021 |
endtry |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1022 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1023 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1024 |
" Section: Command definitions {{{1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1025 |
" Section: Primary commands {{{2 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1026 |
com! HGAdd call s:HGAdd() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1027 |
com! -nargs=? HGAnnotate call s:HGAnnotate(<f-args>) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1028 |
com! -bang -nargs=? HGCommit call s:HGCommit(<q-bang>, <q-args>) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1029 |
com! -nargs=* HGDiff call s:HGDiff(<f-args>) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1030 |
com! -bang HGGotoOriginal call s:HGGotoOriginal(<q-bang>) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1031 |
com! -nargs=? HGLog call s:HGLog(<f-args>) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1032 |
com! HGRevert call s:HGRevert() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1033 |
com! -nargs=? HGReview call s:HGReview(<f-args>) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1034 |
com! HGStatus call s:HGStatus() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1035 |
com! HGUpdate call s:HGUpdate() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1036 |
com! -nargs=* HGVimDiff call s:HGVimDiff(<f-args>) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1037 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1038 |
" Section: HG buffer management commands {{{2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1039 |
com! HGDisableBufferSetup call HGDisableBufferSetup() |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1040 |
com! HGEnableBufferSetup call HGEnableBufferSetup() |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1041 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1042 |
" Allow reloading hgcommand.vim |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1043 |
com! HGReload unlet! loaded_hgcommand | runtime plugin/hgcommand.vim |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1044 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1045 |
" Section: Plugin command mappings {{{1 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1046 |
nnoremap <silent> <Plug>HGAdd :HGAdd<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1047 |
nnoremap <silent> <Plug>HGAnnotate :HGAnnotate<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1048 |
nnoremap <silent> <Plug>HGCommit :HGCommit<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1049 |
nnoremap <silent> <Plug>HGDiff :HGDiff<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1050 |
nnoremap <silent> <Plug>HGGotoOriginal :HGGotoOriginal<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1051 |
nnoremap <silent> <Plug>HGClearAndGotoOriginal :HGGotoOriginal!<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1052 |
nnoremap <silent> <Plug>HGLog :HGLog<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1053 |
nnoremap <silent> <Plug>HGRevert :HGRevert<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1054 |
nnoremap <silent> <Plug>HGReview :HGReview<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1055 |
nnoremap <silent> <Plug>HGStatus :HGStatus<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1056 |
nnoremap <silent> <Plug>HGUpdate :HGUpdate<CR> |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1057 |
nnoremap <silent> <Plug>HGVimDiff :HGVimDiff<CR> |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1058 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1059 |
" Section: Default mappings {{{1 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1060 |
if !hasmapto('<Plug>HGAdd') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1061 |
nmap <unique> <Leader>hga <Plug>HGAdd |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1062 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1063 |
if !hasmapto('<Plug>HGAnnotate') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1064 |
nmap <unique> <Leader>hgn <Plug>HGAnnotate |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1065 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1066 |
if !hasmapto('<Plug>HGClearAndGotoOriginal') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1067 |
nmap <unique> <Leader>hgG <Plug>HGClearAndGotoOriginal |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1068 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1069 |
if !hasmapto('<Plug>HGCommit') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1070 |
nmap <unique> <Leader>hgc <Plug>HGCommit |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1071 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1072 |
if !hasmapto('<Plug>HGDiff') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1073 |
nmap <unique> <Leader>hgd <Plug>HGDiff |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1074 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1075 |
if !hasmapto('<Plug>HGGotoOriginal') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1076 |
nmap <unique> <Leader>hgg <Plug>HGGotoOriginal |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1077 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1078 |
if !hasmapto('<Plug>HGLog') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1079 |
nmap <unique> <Leader>hgl <Plug>HGLog |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1080 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1081 |
if !hasmapto('<Plug>HGRevert') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1082 |
nmap <unique> <Leader>hgq <Plug>HGRevert |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1083 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1084 |
if !hasmapto('<Plug>HGReview') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1085 |
nmap <unique> <Leader>hgr <Plug>HGReview |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1086 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1087 |
if !hasmapto('<Plug>HGStatus') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1088 |
nmap <unique> <Leader>hgs <Plug>HGStatus |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1089 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1090 |
if !hasmapto('<Plug>HGUpdate') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1091 |
nmap <unique> <Leader>hgu <Plug>HGUpdate |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1092 |
endif |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1093 |
if !hasmapto('<Plug>HGVimDiff') |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1094 |
nmap <unique> <Leader>hgv <Plug>HGVimDiff |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1095 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1096 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1097 |
" Section: Menu items {{{1 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1098 |
silent! aunmenu Plugin.HG |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1099 |
amenu <silent> &Plugin.HG.&Add <Plug>HGAdd |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1100 |
amenu <silent> &Plugin.HG.A&nnotate <Plug>HGAnnotate |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1101 |
amenu <silent> &Plugin.HG.&Commit <Plug>HGCommit |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1102 |
amenu <silent> &Plugin.HG.&Diff <Plug>HGDiff |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1103 |
amenu <silent> &Plugin.HG.&Log <Plug>HGLog |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1104 |
amenu <silent> &Plugin.HG.Revert <Plug>HGRevert |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1105 |
amenu <silent> &Plugin.HG.&Review <Plug>HGReview |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1106 |
amenu <silent> &Plugin.HG.&Status <Plug>HGStatus |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1107 |
amenu <silent> &Plugin.HG.&Update <Plug>HGUpdate |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1108 |
amenu <silent> &Plugin.HG.&VimDiff <Plug>HGVimDiff |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1109 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1110 |
" Section: Autocommands to restore vimdiff state {{{1 |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1111 |
function! s:HGVimDiffRestore(vimDiffBuff) |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1112 |
let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning + 1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1113 |
try |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1114 |
if exists("s:vimDiffSourceBuffer") |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1115 |
if a:vimDiffBuff == s:vimDiffSourceBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1116 |
" Original file is being removed. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1117 |
unlet! s:vimDiffSourceBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1118 |
unlet! s:vimDiffBufferCount |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1119 |
unlet! s:vimDiffRestoreCmd |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1120 |
unlet! s:vimDiffScratchList |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1121 |
elseif match(s:vimDiffScratchList, '{' . a:vimDiffBuff . '}') >= 0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1122 |
let s:vimDiffScratchList = substitute(s:vimDiffScratchList, '{' . a:vimDiffBuff . '}', '', '') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1123 |
let s:vimDiffBufferCount = s:vimDiffBufferCount - 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1124 |
if s:vimDiffBufferCount == 1 && exists('s:vimDiffRestoreCmd') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1125 |
" All scratch buffers are gone, reset the original. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1126 |
" Only restore if the source buffer is still in Diff mode |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1127 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1128 |
let sourceWinNR=bufwinnr(s:vimDiffSourceBuffer) |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1129 |
if sourceWinNR != -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1130 |
" The buffer is visible in at least one window |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1131 |
let currentWinNR = winnr() |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1132 |
while winbufnr(sourceWinNR) != -1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1133 |
if winbufnr(sourceWinNR) == s:vimDiffSourceBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1134 |
execute sourceWinNR . 'wincmd w' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1135 |
if getwinvar('', "&diff") |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1136 |
execute s:vimDiffRestoreCmd |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1137 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1138 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1139 |
let sourceWinNR = sourceWinNR + 1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1140 |
endwhile |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1141 |
execute currentWinNR . 'wincmd w' |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1142 |
else |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1143 |
" The buffer is hidden. It must be visible in order to set the |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1144 |
" diff option. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1145 |
let currentBufNR = bufnr('') |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1146 |
execute "hide buffer" s:vimDiffSourceBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1147 |
if getwinvar('', "&diff") |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1148 |
execute s:vimDiffRestoreCmd |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1149 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1150 |
execute "hide buffer" currentBufNR |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1151 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1152 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1153 |
unlet s:vimDiffRestoreCmd |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1154 |
unlet s:vimDiffSourceBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1155 |
unlet s:vimDiffBufferCount |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1156 |
unlet s:vimDiffScratchList |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1157 |
elseif s:vimDiffBufferCount == 0 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1158 |
" All buffers are gone. |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1159 |
unlet s:vimDiffSourceBuffer |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1160 |
unlet s:vimDiffBufferCount |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1161 |
unlet s:vimDiffScratchList |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1162 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1163 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1164 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1165 |
finally |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1166 |
let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning - 1 |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1167 |
endtry |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1168 |
endfunction |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1169 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1170 |
augroup HGVimDiffRestore |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1171 |
au! |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1172 |
au BufUnload * call s:HGVimDiffRestore(expand("<abuf>")) |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1173 |
augroup END |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1174 |
|
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1175 |
" Section: Optional activation of buffer management {{{1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1176 |
|
2607
070736e20dfd
HGcommand.vim : HGCommandEnableBufferSetup on by default
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2606
diff
changeset
|
1177 |
if s:HGGetOption('HGCommandEnableBufferSetup', 1) |
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1178 |
call HGEnableBufferSetup() |
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1179 |
endif |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1180 |
|
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1181 |
" Section: Doc installation {{{1 |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1182 |
" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1183 |
let s:revision="0.1" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1184 |
silent! let s:install_status = |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1185 |
\ s:HGInstallDocumentation(expand('<sfile>:p'), s:revision) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1186 |
if (s:install_status == 1) |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1187 |
echom expand("<sfile>:t:r") . ' v' . s:revision . |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1188 |
\ ': Help-documentation installed.' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1189 |
endif |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1190 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1191 |
|
2591
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1192 |
" Section: Plugin completion {{{1 |
61f2008cd6bf
Addition of CVScommand vim script as a base for HGcommand
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
diff
changeset
|
1193 |
|
2592
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1194 |
let loaded_hgcommand=2 |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1195 |
silent do HGCommand User HGPluginFinish |
457846f400e8
Vim script: Adaptation from CVS to Mercurial
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2591
diff
changeset
|
1196 |
" vim:se expandtab sts=2 sw=2: |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1197 |
finish |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1198 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1199 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1200 |
" Section: Documentation content {{{1 |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1201 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1202 |
=== START_DOC |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1203 |
*hgcommand.txt* Mercurial vim integration #version# |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1204 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1205 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1206 |
HGCOMMAND REFERENCE MANUAL~ |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1207 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1208 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1209 |
Author: Mathieu Clabaut <mathieu.clabaut@gmail.com> |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1210 |
Credits: Bob Hiestand <bob.hiestand@gmail.com> |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1211 |
Mercurial: http://www.selenic.com/mercurial |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1212 |
Mercurial (noted Hg) is a fast, lightweight Source Control Management |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1213 |
system designed for efficient handling of very large distributed projects. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1214 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1215 |
============================================================================== |
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1216 |
1. Contents *hgcommand-contents* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1217 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1218 |
Installation : |hgcommand-install| |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1219 |
HGCommand Intro : |hgcommand| |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1220 |
HGCommand Manual : |hgcommand-manual| |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1221 |
Customization : |hgcommand-customize| |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1222 |
Bugs : |hgcommand-bugs| |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1223 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1224 |
============================================================================== |
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1225 |
2. HGCommand Installation *hgcommand-install* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1226 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1227 |
In order to install the plugin, place the hgcommand.vim file into a plugin' |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1228 |
directory in your runtime path (please see |add-global-plugin| and |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1229 |
|'runtimepath'|. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1230 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1231 |
HGCommand may be customized by setting variables, creating maps, and |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1232 |
specifying event handlers. Please see |hgcommand-customize| for more |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1233 |
details. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1234 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1235 |
*hgcommand-auto-help* |
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1236 |
The help file is automagically generated when the |hgcommand| script is |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1237 |
loaded for the first time. |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1238 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1239 |
============================================================================== |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1240 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1241 |
3. HGCommand Intro *hgcommand* |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1242 |
*hgcommand-intro* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1243 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1244 |
The HGCommand plugin provides global ex commands for manipulating |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1245 |
HG-controlled source files. In general, each command operates on the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1246 |
current buffer and accomplishes a separate hg function, such as update, |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1247 |
commit, log, and others (please see |hgcommand-commands| for a list of all |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1248 |
available commands). The results of each operation are displayed in a |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1249 |
scratch buffer. Several buffer variables are defined for those scratch |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1250 |
buffers (please see |hgcommand-buffer-variables|). |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1251 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1252 |
The notion of "current file" means either the current buffer, or, in the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1253 |
case of a directory buffer, the file on the current line within the buffer. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1254 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1255 |
For convenience, any HGCommand invoked on a HGCommand scratch buffer acts |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1256 |
as though it was invoked on the original file and splits the screen so that |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1257 |
the output appears in a new window. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1258 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1259 |
Many of the commands accept revisions as arguments. By default, most |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1260 |
operate on the most recent revision on the current branch if no revision is |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1261 |
specified (though see |HGCommandInteractive| to prompt instead). |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1262 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1263 |
Each HGCommand is mapped to a key sequence starting with the <Leader> |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1264 |
keystroke. The default mappings may be overridden by supplying different |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1265 |
mappings before the plugin is loaded, such as in the vimrc, in the standard |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1266 |
fashion for plugin mappings. For examples, please see |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1267 |
|hgcommand-mappings-override|. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1268 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1269 |
The HGCommand plugin may be configured in several ways. For more details, |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1270 |
please see |hgcommand-customize|. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1271 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1272 |
============================================================================== |
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1273 |
4. HGCommand Manual *hgcommand-manual* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1274 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1275 |
4.1 HGCommand commands *hgcommand-commands* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1276 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1277 |
HGCommand defines the following commands: |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1278 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1279 |
|:HGAdd| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1280 |
|:HGAnnotate| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1281 |
|:HGCommit| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1282 |
|:HGDiff| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1283 |
|:HGGotoOriginal| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1284 |
|:HGLog| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1285 |
|:HGRevert| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1286 |
|:HGReview| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1287 |
|:HGStatus| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1288 |
|:HGUpdate| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1289 |
|:HGVimDiff| |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1290 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1291 |
:HGAdd *:HGAdd* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1292 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1293 |
This command performs "hg add" on the current file. Please note, this does |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1294 |
not commit the newly-added file. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1295 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1296 |
:HGAnnotate *:HGAnnotate* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1297 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1298 |
This command performs "hg annotate" on the current file. If an argument is |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1299 |
given, the argument is used as a revision number to display. If not given |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1300 |
an argument, it uses the most recent version of the file on the current |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1301 |
branch. Additionally, if the current buffer is a HGAnnotate buffer |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1302 |
already, the version number on the current line is used. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1303 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1304 |
If the |HGCommandAnnotateParent| variable is set to a non-zero value, the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1305 |
version previous to the one on the current line is used instead. This |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1306 |
allows one to navigate back to examine the previous version of a line. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1307 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1308 |
The filetype of the HGCommand scratch buffer is set to 'HGAnnotate', to |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1309 |
take advantage of the bundled syntax file. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1310 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1311 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1312 |
:HGCommit[!] *:HGCommit* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1313 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1314 |
If called with arguments, this performs "hg commit" using the arguments as |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1315 |
the log message. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1316 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1317 |
If '!' is used with no arguments, an empty log message is committed. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1318 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1319 |
If called with no arguments, this is a two-step command. The first step |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1320 |
opens a buffer to accept a log message. When that buffer is written, it is |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1321 |
automatically closed and the file is committed using the information from |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1322 |
that log message. The commit can be abandoned if the log message buffer is |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1323 |
deleted or wiped before being written. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1324 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1325 |
Alternatively, the mapping that is used to invoke :HGCommit (by default |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1326 |
<Leader>hgc) can be used in the log message buffer to immediately commit. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1327 |
This is useful if the |HGCommandCommitOnWrite| variable is set to 0 to |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1328 |
disable the normal commit-on-write behavior. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1329 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1330 |
:HGDiff *:HGDiff* |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1331 |
|
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1332 |
With no arguments, this performs "hg diff" on the current file against the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1333 |
current repository version. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1334 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1335 |
With one argument, "hg diff" is performed on the current file against the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1336 |
specified revision. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1337 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1338 |
With two arguments, hg diff is performed between the specified revisions of |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1339 |
the current file. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1340 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1341 |
This command uses the 'HGCommandDiffOpt' variable to specify diff options. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1342 |
If that variable does not exist, then 'wbBc' is assumed. If you wish to |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1343 |
have no options, then set it to the empty string. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1344 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1345 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1346 |
:HGGotoOriginal *:HGGotoOriginal* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1347 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1348 |
This command returns the current window to the source buffer, if the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1349 |
current buffer is a HG command output buffer. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1350 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1351 |
:HGGotoOriginal! |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1352 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1353 |
Like ":HGGotoOriginal" but also executes :bufwipeout on all HG command |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1354 |
output buffers for the source buffer. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1355 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1356 |
:HGLog *:HGLog* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1357 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1358 |
Performs "hg log" on the current file. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1359 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1360 |
If an argument is given, it is passed as an argument to the "-r" option of |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1361 |
"hg log". |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1362 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1363 |
:HGRevert *:HGRevert* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1364 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1365 |
Replaces the current file with the most recent version from the repository |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1366 |
in order to wipe out any undesired changes. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1367 |
|
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1368 |
:HGReview *:HGReview* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1369 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1370 |
Retrieves a particular version of the current file. If no argument is |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1371 |
given, the most recent version of the file on the current branch is |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1372 |
retrieved. Otherwise, the specified version is retrieved. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1373 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1374 |
:HGStatus *:HGStatus* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1375 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1376 |
Performs "hg status" on the current file. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1377 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1378 |
:HGUpdate *:HGUpdate* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1379 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1380 |
Performs "hg update" on the current file. This intentionally does not |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1381 |
automatically reload the current buffer, though vim should prompt the user |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1382 |
to do so if the underlying file is altered by this command. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1383 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1384 |
:HGVimDiff *:HGVimDiff* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1385 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1386 |
With no arguments, this prompts the user for a revision and then uses |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1387 |
vimdiff to display the differences between the current file and the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1388 |
specified revision. If no revision is specified, the most recent version |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1389 |
of the file on the current branch is used. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1390 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1391 |
With one argument, that argument is used as the revision as above. With |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1392 |
two arguments, the differences between the two revisions is displayed using |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1393 |
vimdiff. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1394 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1395 |
With either zero or one argument, the original buffer is used to perform |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1396 |
the vimdiff. When the other buffer is closed, the original buffer will be |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1397 |
returned to normal mode. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1398 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1399 |
Once vimdiff mode is started using the above methods, additional vimdiff |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1400 |
buffers may be added by passing a single version argument to the command. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1401 |
There may be up to 4 vimdiff buffers total. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1402 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1403 |
Using the 2-argument form of the command resets the vimdiff to only those 2 |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1404 |
versions. Additionally, invoking the command on a different file will |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1405 |
close the previous vimdiff buffers. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1406 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1407 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1408 |
4.2 Mappings *hgcommand-mappings* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1409 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1410 |
By default, a mapping is defined for each command. These mappings execute |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1411 |
the default (no-argument) form of each command. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1412 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1413 |
<Leader>hga HGAdd |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1414 |
<Leader>hgn HGAnnotate |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1415 |
<Leader>hgc HGCommit |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1416 |
<Leader>hgd HGDiff |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1417 |
<Leader>hgg HGGotoOriginal |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1418 |
<Leader>hgG HGGotoOriginal! |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1419 |
<Leader>hgl HGLog |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1420 |
<Leader>hgr HGReview |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1421 |
<Leader>hgs HGStatus |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1422 |
<Leader>hgu HGUpdate |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1423 |
<Leader>hgv HGVimDiff |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1424 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1425 |
*hgcommand-mappings-override* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1426 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1427 |
The default mappings can be overriden by user-provided instead by mapping |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1428 |
to <Plug>CommandName. This is especially useful when these mappings |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1429 |
collide with other existing mappings (vim will warn of this during plugin |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1430 |
initialization, but will not clobber the existing mappings). |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1431 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1432 |
For instance, to override the default mapping for :HGAdd to set it to |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1433 |
'\add', add the following to the vimrc: > |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1434 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1435 |
nmap \add <Plug>HGAdd |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1436 |
< |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1437 |
4.3 Automatic buffer variables *hgcommand-buffer-variables* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1438 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1439 |
Several buffer variables are defined in each HGCommand result buffer. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1440 |
These may be useful for additional customization in callbacks defined in |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1441 |
the event handlers (please see |hgcommand-events|). |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1442 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1443 |
The following variables are automatically defined: |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1444 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1445 |
b:hgOrigBuffNR *b:hgOrigBuffNR* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1446 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1447 |
This variable is set to the buffer number of the source file. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1448 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1449 |
b:hgcmd *b:hgcmd* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1450 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1451 |
This variable is set to the name of the hg command that created the result |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1452 |
buffer. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1453 |
============================================================================== |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1454 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1455 |
5. Configuration and customization *hgcommand-customize* |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1456 |
*hgcommand-config* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1457 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1458 |
The HGCommand plugin can be configured in two ways: by setting |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1459 |
configuration variables (see |hgcommand-options|) or by defining HGCommand |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1460 |
event handlers (see |hgcommand-events|). Additionally, the HGCommand |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1461 |
plugin provides several option for naming the HG result buffers (see |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1462 |
|hgcommand-naming|) and supported a customized status line (see |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1463 |
|hgcommand-statusline| and |hgcommand-buffer-management|). |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1464 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1465 |
5.1 HGCommand configuration variables *hgcommand-options* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1466 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1467 |
Several variables affect the plugin's behavior. These variables are |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1468 |
checked at time of execution, and may be defined at the window, buffer, or |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1469 |
global level and are checked in that order of precedence. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1470 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1471 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1472 |
The following variables are available: |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1473 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1474 |
|HGCommandAnnotateParent| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1475 |
|HGCommandCommitOnWrite| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1476 |
|HGCommandHGExec| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1477 |
|HGCommandDeleteOnHide| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1478 |
|HGCommandDiffOpt| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1479 |
|HGCommandDiffSplit| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1480 |
|HGCommandEdit| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1481 |
|HGCommandEnableBufferSetup| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1482 |
|HGCommandInteractive| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1483 |
|HGCommandNameMarker| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1484 |
|HGCommandNameResultBuffers| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1485 |
|HGCommandSplit| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1486 |
|
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1487 |
HGCommandAnnotateParent *HGCommandAnnotateParent* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1488 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1489 |
This variable, if set to a non-zero value, causes the zero-argument form of |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1490 |
HGAnnotate when invoked on a HGAnnotate buffer to go to the version |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1491 |
previous to that displayed on the current line. If not set, it defaults to |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1492 |
0. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1493 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1494 |
HGCommandCommitOnWrite *HGCommandCommitOnWrite* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1495 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1496 |
This variable, if set to a non-zero value, causes the pending hg commit to |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1497 |
take place immediately as soon as the log message buffer is written. If |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1498 |
set to zero, only the HGCommit mapping will cause the pending commit to |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1499 |
occur. If not set, it defaults to 1. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1500 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1501 |
HGCommandHGExec *HGCommandHGExec* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1502 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1503 |
This variable controls the executable used for all HG commands. If not |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1504 |
set, it defaults to "hg". |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1505 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1506 |
HGCommandDeleteOnHide *HGCommandDeleteOnHide* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1507 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1508 |
This variable, if set to a non-zero value, causes the temporary HG result |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1509 |
buffers to automatically delete themselves when hidden. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1510 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1511 |
HGCommandDiffOpt *HGCommandDiffOpt* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1512 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1513 |
This variable, if set, determines the options passed to the diff command of |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1514 |
HG. If not set, it defaults to 'w'. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1515 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1516 |
HGCommandDiffSplit *HGCommandDiffSplit* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1517 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1518 |
This variable overrides the |HGCommandSplit| variable, but only for buffers |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1519 |
created with |:HGVimDiff|. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1520 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1521 |
HGCommandEdit *HGCommandEdit* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1522 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1523 |
This variable controls whether the original buffer is replaced ('edit') or |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1524 |
split ('split'). If not set, it defaults to 'edit'. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1525 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1526 |
HGCommandEnableBufferSetup *HGCommandEnableBufferSetup* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1527 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1528 |
This variable, if set to a non-zero value, activates HG buffer management |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1529 |
mode see (|hgcommand-buffer-management|). This mode means that three |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1530 |
buffer variables, 'HGRepository', 'HGRevision' and 'HGBranch', are set if |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1531 |
the file is HG-controlled. This is useful for displaying version |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1532 |
information in the status bar. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1533 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1534 |
HGCommandInteractive *HGCommandInteractive* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1535 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1536 |
This variable, if set to a non-zero value, causes appropriate commands (for |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1537 |
the moment, only |:HGReview|) to query the user for a revision to use |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1538 |
instead of the current revision if none is specified. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1539 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1540 |
HGCommandNameMarker *HGCommandNameMarker* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1541 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1542 |
This variable, if set, configures the special attention-getting characters |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1543 |
that appear on either side of the hg buffer type in the buffer name. This |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1544 |
has no effect unless |HGCommandNameResultBuffers| is set to a true value. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1545 |
If not set, it defaults to '_'. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1546 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1547 |
HGCommandNameResultBuffers *HGCommandNameResultBuffers* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1548 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1549 |
This variable, if set to a true value, causes the hg result buffers to be |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1550 |
named in the old way ('<source file name> _<hg command>_'). If not set or |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1551 |
set to a false value, the result buffer is nameless. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1552 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1553 |
HGCommandSplit *HGCommandSplit* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1554 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1555 |
This variable controls the orientation of the various window splits that |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1556 |
may occur (such as with HGVimDiff, when using a HG command on a HG command |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1557 |
buffer, or when the |HGCommandEdit| variable is set to 'split'. If set to |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1558 |
'horizontal', the resulting windows will be on stacked on top of one |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1559 |
another. If set to 'vertical', the resulting windows will be side-by-side. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1560 |
If not set, it defaults to 'horizontal' for all but HGVimDiff windows. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1561 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1562 |
5.2 HGCommand events *hgcommand-events* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1563 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1564 |
For additional customization, HGCommand can trigger user-defined events. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1565 |
Event handlers are provided by defining User event autocommands (see |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1566 |
|autocommand|, |User|) in the HGCommand group with patterns matching the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1567 |
event name. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1568 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1569 |
For instance, the following could be added to the vimrc to provide a 'q' |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1570 |
mapping to quit a HGCommand scratch buffer: > |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1571 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1572 |
augroup HGCommand |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1573 |
au HGCommand User HGBufferCreated silent! nmap <unique> <buffer> q: |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1574 |
bwipeout<cr> |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1575 |
augroup END |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1576 |
< |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1577 |
|
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1578 |
The following hooks are available: |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1579 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1580 |
HGBufferCreated This event is fired just after a hg command result |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1581 |
buffer is created and filled with the result of a hg |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1582 |
command. It is executed within the context of the HG |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1583 |
command buffer. The HGCommand buffer variables may be |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1584 |
useful for handlers of this event (please see |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1585 |
|hgcommand-buffer-variables|). |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1586 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1587 |
HGBufferSetup This event is fired just after HG buffer setup occurs, |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1588 |
if enabled. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1589 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1590 |
HGPluginInit This event is fired when the HGCommand plugin first |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1591 |
loads. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1592 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1593 |
HGPluginFinish This event is fired just after the HGCommand plugin |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1594 |
loads. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1595 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1596 |
HGVimDiffFinish This event is fired just after the HGVimDiff command |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1597 |
executes to allow customization of, for instance, |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1598 |
window placement and focus. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1599 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1600 |
5.3 HGCommand buffer naming *hgcommand-naming* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1601 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1602 |
By default, the buffers containing the result of HG commands are nameless |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1603 |
scratch buffers. It is intended that buffer variables of those buffers be |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1604 |
used to customize the statusline option so that the user may fully control |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1605 |
the display of result buffers. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1606 |
|
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1607 |
If the old-style naming is desired, please enable the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1608 |
|HGCommandNameResultBuffers| variable. Then, each result buffer will |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1609 |
receive a unique name that includes the source file name, the HG command, |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1610 |
and any extra data (such as revision numbers) that were part of the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1611 |
command. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1612 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1613 |
5.4 HGCommand status line support *hgcommand-statusline* |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1614 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1615 |
It is intended that the user will customize the |'statusline'| option to |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1616 |
include HG result buffer attributes. A sample function that may be used in |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1617 |
the |'statusline'| option is provided by the plugin, HGGetStatusLine(). In |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1618 |
order to use that function in the status line, do something like the |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1619 |
following: > |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1620 |
|
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1621 |
set statusline=%<%f\ %{HGGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1622 |
< |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1623 |
of which %{HGGetStatusLine()} is the relevant portion. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1624 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1625 |
The sample HGGetStatusLine() function handles both HG result buffers and |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1626 |
HG-managed files if HGCommand buffer management is enabled (please see |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1627 |
|hgcommand-buffer-management|). |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1628 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1629 |
5.5 HGCommand buffer management *hgcommand-buffer-management* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1630 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1631 |
The HGCommand plugin can operate in buffer management mode, which means |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1632 |
that it attempts to set two buffer variables ('HGRevision' and 'HGBranch') |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1633 |
upon entry into a buffer. This is rather slow because it means that 'hg |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1634 |
status' will be invoked at each entry into a buffer (during the |BufEnter| |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1635 |
autocommand). |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1636 |
|
2607
070736e20dfd
HGcommand.vim : HGCommandEnableBufferSetup on by default
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2606
diff
changeset
|
1637 |
This mode is enablmed by default. In order to disable it, set the |
070736e20dfd
HGcommand.vim : HGCommandEnableBufferSetup on by default
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2606
diff
changeset
|
1638 |
|HGCommandEnableBufferSetup| variable to a false (zero) value. Enabling |
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1639 |
this mode simply provides the buffer variables mentioned above. The user |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1640 |
must explicitly include those in the |'statusline'| option if they are to |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1641 |
appear in the status line (but see |hgcommand-statusline| for a simple way |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1642 |
to do that). |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1643 |
|
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1644 |
============================================================================== |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1645 |
9. Tips *hgcommand-tips* |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1646 |
|
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1647 |
9.1 Split window annotation, by Michael Anderson > |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1648 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1649 |
:nmap <Leader>hgN :vs<CR><C-w>h<Leader>hgn:vertical res 40<CR> |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1650 |
\ggdddd:set scb<CR>:set nowrap<CR><C-w>lgg:set scb<CR> |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1651 |
\:set nowrap<CR> |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1652 |
< |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1653 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1654 |
This splits the buffer vertically, puts an annotation on the left (minus |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1655 |
the header) with the width set to 40. An editable/normal copy is placed on |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1656 |
the right. The two versions are scroll locked so they move as one. and |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1657 |
wrapping is turned off so that the lines line up correctly. The advantages |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1658 |
are... |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1659 |
|
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1660 |
1) You get a versioning on the right. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1661 |
2) You can still edit your own code. |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1662 |
3) Your own code still has syntax highlighting. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1663 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1664 |
============================================================================== |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1665 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1666 |
8. Known bugs *hgcommand-bugs* |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1667 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1668 |
Please let me know if you run across any. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1669 |
|
2604
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1670 |
HGVimDiff, when using the original (real) source buffer as one of the diff |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1671 |
buffers, uses some hacks to try to restore the state of the original buffer |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1672 |
when the scratch buffer containing the other version is destroyed. There |
d93c23b31797
HGcommand.vim : doc review.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2603
diff
changeset
|
1673 |
may still be bugs in here, depending on many configuration details. |
2603
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1674 |
|
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1675 |
============================================================================== |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1676 |
=== END_DOC |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1677 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1678 |
" v im:tw=78:ts=8:ft=help:norl: |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1679 |
" vim600: set foldmethod=marker tabstop=8 shiftwidth=2 softtabstop=2 smartindent smarttab : |
f80057407c07
HGcommand.vim : doc integration
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2592
diff
changeset
|
1680 |
"fileencoding=iso-8859-15 |