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