Show More
@@ -1,33 +1,33 b'' | |||
|
1 |
* |
|
|
1 | *hgcommand.txt* HGCommand | |
|
2 | 2 | |
|
3 | 3 | For instructions on installing this file, type |
|
4 | 4 | :help add-local-help |
|
5 | 5 | inside Vim. |
|
6 | 6 | |
|
7 | Author: Bob Hiestand <bob.hiestand@gmail.com> | |
|
8 | Credits: Benji Fisher's excellent MatchIt documentation | |
|
7 | Author: Mathieu Clabaut <mathieu.clabaut@gmail.com> | |
|
8 | Credits: Bob Hiestand <bob.hiestand@gmail.com> | |
|
9 | 9 | |
|
10 | 10 | ============================================================================== |
|
11 |
1. Contents * |
|
|
11 | 1. Contents *hgcommand-contents* | |
|
12 | 12 | |
|
13 |
Installation : | |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
Customization : | |
|
|
17 |
SSH "integration" : | |
|
|
18 |
Bugs : | |
|
|
13 | Installation : |hgcommand-install| | |
|
14 | HGCommand Intro : |hgcommand| | |
|
15 | HGCommand Manual : |hgcommand-manual| | |
|
16 | Customization : |hgcommand-customize| | |
|
17 | SSH "integration" : |hgcommand-ssh| | |
|
18 | Bugs : |hgcommand-bugs| | |
|
19 | 19 | |
|
20 | 20 | ============================================================================== |
|
21 | 21 | |
|
22 |
2. |
|
|
22 | 2. HGCommand Installation *hgcommand-install* | |
|
23 | 23 | |
|
24 |
The |
|
|
25 |
(this file). In order to install the plugin, place the |
|
|
24 | The HGCommand plugin comprises two files, hgcommand.vim and hgcommand.txt | |
|
25 | (this file). In order to install the plugin, place the hgcommand.vim file | |
|
26 | 26 | into a plugin' directory in your runtime path (please see |add-global-plugin| |
|
27 | 27 | and |'runtimepath'|. |
|
28 | 28 | |
|
29 |
|
|
|
30 |
specifying event handlers. Please see | |
|
|
29 | HGCommand may be customized by setting variables, creating maps, and | |
|
30 | specifying event handlers. Please see |hgcommand-customize| for more | |
|
31 | 31 | details. |
|
32 | 32 | |
|
33 | 33 | This help file can be included in the VIM help system by copying it into a |
@@ -37,90 +37,82 b' command, specifying the full path of the' | |||
|
37 | 37 | |
|
38 | 38 | ============================================================================== |
|
39 | 39 | |
|
40 |
3. |
|
|
41 |
* |
|
|
40 | 3. HGCommand Intro *hgcommand* | |
|
41 | *hgcommand-intro* | |
|
42 | 42 | |
|
43 |
The |
|
|
44 |
|
|
|
45 |
buffer and accomplishes a separate |
|
|
46 |
and others (please see | |
|
|
43 | The HGCommand plugin provides global ex commands for manipulating | |
|
44 | HG-controlled source files. In general, each command operates on the current | |
|
45 | buffer and accomplishes a separate hg function, such as update, commit, log, | |
|
46 | and others (please see |hgcommand-commands| for a list of all available | |
|
47 | 47 | commands). The results of each operation are displayed in a scratch buffer. |
|
48 | 48 | Several buffer variables are defined for those scratch buffers (please see |
|
49 |
| |
|
|
49 | |hgcommand-buffer-variables|). | |
|
50 | 50 | |
|
51 | 51 | The notion of "current file" means either the current buffer, or, in the case |
|
52 | 52 | of a directory buffer, the file on the current line within the buffer. |
|
53 | 53 | |
|
54 |
For convenience, any |
|
|
54 | For convenience, any HGCommand invoked on a HGCommand scratch buffer acts as | |
|
55 | 55 | though it was invoked on the original file and splits the screen so that the |
|
56 | 56 | output appears in a new window. |
|
57 | 57 | |
|
58 | 58 | Many of the commands accept revisions as arguments. By default, most operate |
|
59 | 59 | on the most recent revision on the current branch if no revision is specified |
|
60 |
(though see | |
|
|
60 | (though see |HGCommandInteractive| to prompt instead). | |
|
61 | 61 | |
|
62 |
Each |
|
|
62 | Each HGCommand is mapped to a key sequence starting with the <Leader> | |
|
63 | 63 | keystroke. The default mappings may be overridden by supplying different |
|
64 | 64 | mappings before the plugin is loaded, such as in the vimrc, in the standard |
|
65 | 65 | fashion for plugin mappings. For examples, please see |
|
66 |
| |
|
|
66 | |hgcommand-mappings-override|. | |
|
67 | 67 | |
|
68 |
The |
|
|
69 |
please see | |
|
|
68 | The HGCommand plugin may be configured in several ways. For more details, | |
|
69 | please see |hgcommand-customize|. | |
|
70 | 70 | |
|
71 | 71 | ============================================================================== |
|
72 | 72 | |
|
73 |
4. |
|
|
73 | 4. HGCommand Manual *hgcommand-manual* | |
|
74 | 74 | |
|
75 |
4.1 |
|
|
75 | 4.1 HGCommand commands *hgcommand-commands* | |
|
76 | 76 | |
|
77 |
|
|
|
77 | HGCommand defines the following commands: | |
|
78 | 78 | |
|
79 |
|: |
|
|
80 |
|: |
|
|
81 |
|: |
|
|
82 |
|: |
|
|
83 | |:CVSEdit| | |
|
84 | |:CVSEditors| | |
|
85 | |:CVSGotoOriginal| | |
|
86 | |:CVSLog| | |
|
87 | |:CVSRevert| | |
|
88 | |:CVSReview| | |
|
89 | |:CVSStatus| | |
|
90 | |:CVSUnedit| | |
|
91 | |:CVSUpdate| | |
|
92 | |:CVSVimDiff| | |
|
93 | |:CVSWatch| | |
|
94 | |:CVSWatchAdd| | |
|
95 | |:CVSWatchOn| | |
|
96 | |:CVSWatchOff| | |
|
97 | |:CVSWatchRemove| | |
|
98 | |:CVSWatchers| | |
|
79 | |:HGAdd| | |
|
80 | |:HGAnnotate| | |
|
81 | |:HGCommit| | |
|
82 | |:HGDiff| | |
|
83 | |:HGGotoOriginal| | |
|
84 | |:HGLog| | |
|
85 | |:HGRevert| | |
|
86 | |:HGReview| | |
|
87 | |:HGStatus| | |
|
88 | |:HGUnedit| | |
|
89 | |:HGUpdate| | |
|
90 | |:HGVimDiff| | |
|
99 | 91 | |
|
100 |
: |
|
|
92 | :HGAdd *:HGAdd* | |
|
101 | 93 | |
|
102 |
This command performs " |
|
|
94 | This command performs "hg add" on the current file. Please note, this does | |
|
103 | 95 | not commit the newly-added file. |
|
104 | 96 | |
|
105 |
: |
|
|
97 | :HGAnnotate *:HGAnnotate* | |
|
106 | 98 | |
|
107 |
This command performs " |
|
|
99 | This command performs "hg annotate" on the current file. If an argument is | |
|
108 | 100 | given, the argument is used as a revision number to display. If not given an |
|
109 | 101 | argument, it uses the most recent version of the file on the current branch. |
|
110 |
Additionally, if the current buffer is a |
|
|
102 | Additionally, if the current buffer is a HGAnnotate buffer already, the | |
|
111 | 103 | version number on the current line is used. |
|
112 | 104 | |
|
113 |
If the | |
|
|
105 | If the |HGCommandAnnotateParent| variable is set to a non-zero value, the | |
|
114 | 106 | version previous to the one on the current line is used instead. This allows |
|
115 | 107 | one to navigate back to examine the previous version of a line. |
|
116 | 108 | |
|
117 |
The filetype of the |
|
|
109 | The filetype of the HGCommand scratch buffer is set to 'HGAnnotate', to take | |
|
118 | 110 | advantage of the bundled syntax file. |
|
119 | 111 | |
|
120 | 112 | |
|
121 |
: |
|
|
113 | :HGCommit[!] *:HGCommit* | |
|
122 | 114 | |
|
123 |
If called with arguments, this performs " |
|
|
115 | If called with arguments, this performs "hg commit" using the arguments as | |
|
124 | 116 | the log message. |
|
125 | 117 | |
|
126 | 118 | If '!' is used with no arguments, an empty log message is committed. |
@@ -131,79 +123,74 b' automatically closed and the file is com' | |||
|
131 | 123 | log message. The commit can be abandoned if the log message buffer is deleted |
|
132 | 124 | or wiped before being written. |
|
133 | 125 | |
|
134 |
Alternatively, the mapping that is used to invoke : |
|
|
135 |
<Leader> |
|
|
136 | is useful if the |CVSCommandCommitOnWrite| variable is set to 0 to disable the | |
|
126 | Alternatively, the mapping that is used to invoke :HGCommit (by default | |
|
127 | <Leader>hgc) can be used in the log message buffer to immediately commit. | |
|
128 | This | |
|
129 | is useful if the |HGCommandCommitOnWrite| variable is set to 0 to disable the | |
|
137 | 130 | normal commit-on-write behavior. |
|
138 | 131 | |
|
139 |
: |
|
|
132 | :HGDiff *:HGDiff* | |
|
140 | 133 | |
|
141 |
With no arguments, this performs " |
|
|
134 | With no arguments, this performs "hg diff" on the current file against the | |
|
142 | 135 | current repository version. |
|
143 | 136 | |
|
144 |
With one argument, " |
|
|
137 | With one argument, "hg diff" is performed on the current file against the | |
|
145 | 138 | specified revision. |
|
146 | 139 | |
|
147 |
With two arguments, |
|
|
140 | With two arguments, hg diff is performed between the specified | |
|
148 | 141 | revisions of the current file. |
|
149 | 142 | |
|
150 |
This command uses the ' |
|
|
143 | This command uses the 'HGCommandDiffOpt' variable to specify diff options. | |
|
151 | 144 | If that variable does not exist, then 'wbBc' is assumed. If you wish to have |
|
152 | 145 | no options, then set it to the empty string. |
|
153 | 146 | |
|
154 | :CVSEdit *:CVSEdit* | |
|
155 | ||
|
156 | This command performs "cvs edit" on the current file. Yes, the output buffer | |
|
157 | in this case is almost completely useless. | |
|
158 | 147 | |
|
159 | :CVSEditors *:CVSEditors* | |
|
148 | This command performs "hg edit" on the current file. | |
|
160 | 149 | |
|
161 | This command performs "cvs edit" on the current file. | |
|
162 | ||
|
163 | :CVSGotoOriginal *:CVSGotoOriginal* | |
|
150 | :HGGotoOriginal *:HGGotoOriginal* | |
|
164 | 151 | |
|
165 | 152 | This command returns the current window to the source buffer, if the current |
|
166 |
buffer is a |
|
|
153 | buffer is a HG command output buffer. | |
|
167 | 154 | |
|
168 |
: |
|
|
155 | :HGGotoOriginal! | |
|
169 | 156 | |
|
170 |
Like ": |
|
|
157 | Like ":HGGotoOriginal" but also executes :bufwipeout on all HG command | |
|
171 | 158 | output buffers for the source buffer. |
|
172 | 159 | |
|
173 |
: |
|
|
160 | :HGLog *:HGLog* | |
|
174 | 161 | |
|
175 |
Performs " |
|
|
162 | Performs "hg log" on the current file. | |
|
176 | 163 | |
|
177 | 164 | If an argument is given, it is passed as an argument to the "-r" option of |
|
178 |
" |
|
|
165 | "hg log". | |
|
179 | 166 | |
|
180 |
: |
|
|
167 | :HGRevert *:HGRevert* | |
|
181 | 168 | |
|
182 | 169 | Replaces the current file with the most recent version from the repository in |
|
183 | 170 | order to wipe out any undesired changes. |
|
184 | 171 | |
|
185 |
: |
|
|
172 | :HGReview *:HGReview* | |
|
186 | 173 | |
|
187 | 174 | Retrieves a particular version of the current file. If no argument is given, |
|
188 | 175 | the most recent version of the file on the current branch is retrieved. |
|
189 | 176 | Otherwise, the specified version is retrieved. |
|
190 | 177 | |
|
191 |
: |
|
|
178 | :HGStatus *:HGStatus* | |
|
192 | 179 | |
|
193 |
Performs " |
|
|
180 | Performs "hg status" on the current file. | |
|
194 | 181 | |
|
195 |
: |
|
|
182 | :HGUnedit *:HGUnedit* | |
|
196 | 183 | |
|
197 |
Performs " |
|
|
184 | Performs "hg unedit" on the current file. Again, yes, the output buffer here | |
|
198 | 185 | is basically useless. |
|
199 | 186 | |
|
200 |
: |
|
|
187 | :HGUpdate *:HGUpdate* | |
|
201 | 188 | |
|
202 |
Performs " |
|
|
189 | Performs "hg update" on the current file. This intentionally does not | |
|
203 | 190 | automatically reload the current buffer, though vim should prompt the user to |
|
204 | 191 | do so if the underlying file is altered by this command. |
|
205 | 192 | |
|
206 |
: |
|
|
193 | :HGVimDiff *:HGVimDiff* | |
|
207 | 194 | |
|
208 | 195 | With no arguments, this prompts the user for a revision and then uses vimdiff |
|
209 | 196 | to display the differences between the current file and the specified |
@@ -226,97 +213,66 b' Using the 2-argument form of the command' | |||
|
226 | 213 | versions. Additionally, invoking the command on a different file will close |
|
227 | 214 | the previous vimdiff buffers. |
|
228 | 215 | |
|
229 | :CVSWatch *:CVSWatch* | |
|
230 | 216 | |
|
231 | This command takes an argument which must be one of [on|off|add|remove]. The | |
|
232 | command performs "cvs watch" with the given argument on the current file. | |
|
233 | ||
|
234 | :CVSWatchAdd *:CVSWatchAdd* | |
|
235 | ||
|
236 | This command is an alias for ":CVSWatch add" | |
|
237 | ||
|
238 | :CVSWatchOn *:CVSWatchOn* | |
|
239 | ||
|
240 | This command is an alias for ":CVSWatch on" | |
|
241 | ||
|
242 | :CVSWatchOff *:CVSWatchOff* | |
|
243 | ||
|
244 | This command is an alias for ":CVSWatch off" | |
|
245 | ||
|
246 | :CVSWatchRemove *:CVSWatchRemove* | |
|
247 | ||
|
248 | This command is an alias for ":CVSWatch remove" | |
|
249 | ||
|
250 | :CVSWatchers *:CVSWatchers* | |
|
251 | ||
|
252 | This command performs "cvs watchers" on the current file. | |
|
253 | ||
|
254 | 4.2 Mappings *cvscommand-mappings* | |
|
217 | 4.2 Mappings *hgcommand-mappings* | |
|
255 | 218 | |
|
256 | 219 | By default, a mapping is defined for each command. These mappings execute the |
|
257 | 220 | default (no-argument) form of each command. |
|
258 | 221 | |
|
259 |
<Leader> |
|
|
260 |
<Leader> |
|
|
261 |
<Leader> |
|
|
262 |
<Leader> |
|
|
263 | <Leader>ce CVSEdit | |
|
264 | <Leader>ci CVSEditors | |
|
265 |
<Leader> |
|
|
266 | <Leader>cG CVSGotoOriginal! | |
|
267 | <Leader>cl CVSLog | |
|
268 | <Leader>cr CVSReview | |
|
269 | <Leader>cs CVSStatus | |
|
270 | <Leader>ct CVSUnedit | |
|
271 | <Leader>cu CVSUpdate | |
|
272 | <Leader>cv CVSVimDiff | |
|
273 | <Leader>cwv CVSWatchers | |
|
274 | <Leader>cwa CVSWatchAdd | |
|
275 | <Leader>cwn CVSWatchOn | |
|
276 | <Leader>cwf CVSWatchOff | |
|
277 | <Leader>cwf CVSWatchRemove | |
|
222 | <Leader>hga HGAdd | |
|
223 | <Leader>hgn HGAnnotate | |
|
224 | <Leader>hgc HGCommit | |
|
225 | <Leader>hgd HGDiff | |
|
226 | <Leader>hgg HGGotoOriginal | |
|
227 | <Leader>hgG HGGotoOriginal! | |
|
228 | <Leader>hgl HGLog | |
|
229 | <Leader>hgr HGReview | |
|
230 | <Leader>hgs HGStatus | |
|
231 | <Leader>hgt HGUnedit | |
|
232 | <Leader>hgu HGUpdate | |
|
233 | <Leader>hgv HGVimDiff | |
|
278 | 234 | |
|
279 |
* |
|
|
235 | *hgcommand-mappings-override* | |
|
280 | 236 | |
|
281 | 237 | The default mappings can be overriden by user-provided instead by mapping to |
|
282 | 238 | <Plug>CommandName. This is especially useful when these mappings collide with |
|
283 | 239 | other existing mappings (vim will warn of this during plugin initialization, |
|
284 | 240 | but will not clobber the existing mappings). |
|
285 | 241 | |
|
286 |
For instance, to override the default mapping for : |
|
|
242 | For instance, to override the default mapping for :HGAdd to set it to '\add', | |
|
287 | 243 | add the following to the vimrc: |
|
288 | 244 | |
|
289 |
nmap \add <Plug> |
|
|
245 | nmap \add <Plug>HGAdd | |
|
290 | 246 | |
|
291 |
4.3 Automatic buffer variables * |
|
|
247 | 4.3 Automatic buffer variables *hgcommand-buffer-variables* | |
|
292 | 248 | |
|
293 |
Several buffer variables are defined in each |
|
|
249 | Several buffer variables are defined in each HGCommand result buffer. These | |
|
294 | 250 | may be useful for additional customization in callbacks defined in the event |
|
295 |
handlers (please see | |
|
|
251 | handlers (please see |hgcommand-events|). | |
|
296 | 252 | |
|
297 | 253 | The following variables are automatically defined: |
|
298 | 254 | |
|
299 |
b: |
|
|
255 | b:hgOrigBuffNR *b:hgOrigBuffNR* | |
|
300 | 256 | |
|
301 | 257 | This variable is set to the buffer number of the source file. |
|
302 | 258 | |
|
303 |
b: |
|
|
259 | b:hgcmd *b:hgcmd* | |
|
304 | 260 | |
|
305 |
This variable is set to the name of the |
|
|
261 | This variable is set to the name of the hg command that created the result | |
|
306 | 262 | buffer. |
|
307 | 263 | ============================================================================== |
|
308 | 264 | |
|
309 |
5. Configuration and customization * |
|
|
310 |
* |
|
|
265 | 5. Configuration and customization *hgcommand-customize* | |
|
266 | *hgcommand-config* | |
|
311 | 267 | |
|
312 |
The |
|
|
313 |
variables (see | |
|
|
314 |
(see | |
|
|
315 |
several option for naming the |
|
|
316 |
supported a customized status line (see | |
|
|
317 |
| |
|
|
268 | The HGCommand plugin can be configured in two ways: by setting configuration | |
|
269 | variables (see |hgcommand-options|) or by defining HGCommand event handlers | |
|
270 | (see |hgcommand-events|). Additionally, the HGCommand plugin provides | |
|
271 | several option for naming the HG result buffers (see |hgcommand-naming|) and | |
|
272 | supported a customized status line (see |hgcommand-statusline| and | |
|
273 | |hgcommand-buffer-management|). | |
|
318 | 274 | |
|
319 |
5.1 |
|
|
275 | 5.1 HGCommand configuration variables *hgcommand-options* | |
|
320 | 276 | |
|
321 | 277 | Several variables affect the plugin's behavior. These variables are checked |
|
322 | 278 | at time of execution, and may be defined at the window, buffer, or global |
@@ -325,181 +281,181 b' level and are checked in that order of p' | |||
|
325 | 281 | |
|
326 | 282 | The following variables are available: |
|
327 | 283 | |
|
328 |
| |
|
|
329 |
| |
|
|
330 |
| |
|
|
331 |
| |
|
|
332 |
| |
|
|
333 |
| |
|
|
334 |
| |
|
|
335 |
| |
|
|
336 |
| |
|
|
337 |
| |
|
|
338 |
| |
|
|
339 |
| |
|
|
284 | |HGCommandAnnotateParent| | |
|
285 | |HGCommandCommitOnWrite| | |
|
286 | |HGCommandHGExec| | |
|
287 | |HGCommandDeleteOnHide| | |
|
288 | |HGCommandDiffOpt| | |
|
289 | |HGCommandDiffSplit| | |
|
290 | |HGCommandEdit| | |
|
291 | |HGCommandEnableBufferSetup| | |
|
292 | |HGCommandInteractive| | |
|
293 | |HGCommandNameMarker| | |
|
294 | |HGCommandNameResultBuffers| | |
|
295 | |HGCommandSplit| | |
|
340 | 296 | |
|
341 |
|
|
|
297 | HGCommandAnnotateParent *HGCommandAnnotateParent* | |
|
342 | 298 | |
|
343 | 299 | This variable, if set to a non-zero value, causes the zero-argument form of |
|
344 |
|
|
|
300 | HGAnnotate when invoked on a HGAnnotate buffer to go to the version previous | |
|
345 | 301 | to that displayed on the current line. If not set, it defaults to 0. |
|
346 | 302 | |
|
347 |
|
|
|
303 | HGCommandCommitOnWrite *HGCommandCommitOnWrite* | |
|
348 | 304 | |
|
349 |
This variable, if set to a non-zero value, causes the pending |
|
|
305 | This variable, if set to a non-zero value, causes the pending hg commit | |
|
350 | 306 | to take place immediately as soon as the log message buffer is written. |
|
351 |
If set to zero, only the |
|
|
307 | If set to zero, only the HGCommit mapping will cause the pending commit to | |
|
352 | 308 | occur. If not set, it defaults to 1. |
|
353 | 309 | |
|
354 |
|
|
|
310 | HGCommandHGExec *HGCommandHGExec* | |
|
355 | 311 | |
|
356 |
This variable controls the executable used for all |
|
|
357 |
it defaults to " |
|
|
312 | This variable controls the executable used for all HG commands If not set, | |
|
313 | it defaults to "hg". | |
|
358 | 314 | |
|
359 |
|
|
|
315 | HGCommandDeleteOnHide *HGCommandDeleteOnHide* | |
|
360 | 316 | |
|
361 |
This variable, if set to a non-zero value, causes the temporary |
|
|
317 | This variable, if set to a non-zero value, causes the temporary HG result | |
|
362 | 318 | buffers to automatically delete themselves when hidden. |
|
363 | 319 | |
|
364 |
|
|
|
320 | HGCommandDiffOpt *HGCommandDiffOpt* | |
|
365 | 321 | |
|
366 | 322 | This variable, if set, determines the options passed to the diff command of |
|
367 |
|
|
|
323 | HG. If not set, it defaults to 'wbBc'. | |
|
368 | 324 | |
|
369 |
|
|
|
325 | HGCommandDiffSplit *HGCommandDiffSplit* | |
|
370 | 326 | |
|
371 |
This variable overrides the | |
|
|
372 |
created with |: |
|
|
327 | This variable overrides the |HGCommandSplit| variable, but only for buffers | |
|
328 | created with |:HGVimDiff|. | |
|
373 | 329 | |
|
374 |
|
|
|
330 | HGCommandEdit *HGCommandEdit* | |
|
375 | 331 | |
|
376 | 332 | This variable controls whether the original buffer is replaced ('edit') or |
|
377 | 333 | split ('split'). If not set, it defaults to 'edit'. |
|
378 | 334 | |
|
379 |
|
|
|
335 | HGCommandEnableBufferSetup *HGCommandEnableBufferSetup* | |
|
380 | 336 | |
|
381 |
This variable, if set to a non-zero value, activates |
|
|
382 |
mode see (| |
|
|
383 |
variables, ' |
|
|
384 |
|
|
|
337 | This variable, if set to a non-zero value, activates HG buffer management | |
|
338 | mode see (|hgcommand-buffer-management|). This mode means that two buffer | |
|
339 | variables, 'HGRevision' and 'HGBranch', are set if the file is | |
|
340 | HG-controlled. This is useful for displaying version information in the | |
|
385 | 341 | status bar. |
|
386 | 342 | |
|
387 |
|
|
|
343 | HGCommandInteractive *HGCommandInteractive* | |
|
388 | 344 | |
|
389 | 345 | This variable, if set to a non-zero value, causes appropriate commands (for |
|
390 |
the moment, only |: |
|
|
346 | the moment, only |:HGReview|) to query the user for a revision to use instead | |
|
391 | 347 | of the current revision if none is specified. |
|
392 | 348 | |
|
393 |
|
|
|
349 | HGCommandNameMarker *HGCommandNameMarker* | |
|
394 | 350 | |
|
395 | 351 | This variable, if set, configures the special attention-getting characters |
|
396 |
that appear on either side of the |
|
|
397 |
has no effect unless | |
|
|
352 | that appear on either side of the hg buffer type in the buffer name. This | |
|
353 | has no effect unless |HGCommandNameResultBuffers| is set to a true value. If | |
|
398 | 354 | not set, it defaults to '_'. |
|
399 | 355 | |
|
400 |
|
|
|
356 | HGCommandNameResultBuffers *HGCommandNameResultBuffers* | |
|
401 | 357 | |
|
402 |
This variable, if set to a true value, causes the |
|
|
403 |
named in the old way ('<source file name> _< |
|
|
358 | This variable, if set to a true value, causes the hg result buffers to be | |
|
359 | named in the old way ('<source file name> _<hg command>_'). If not set | |
|
404 | 360 | or set to a false value, the result buffer is nameless. |
|
405 | 361 | |
|
406 |
|
|
|
362 | HGCommandSplit *HGCommandSplit* | |
|
407 | 363 | |
|
408 | 364 | This variable controls the orientation of the various window splits that |
|
409 |
may occur (such as with |
|
|
410 |
command buffer, or when the | |
|
|
365 | may occur (such as with HGVimDiff, when using a HG command on a HG | |
|
366 | command buffer, or when the |HGCommandEdit| variable is set to 'split'. | |
|
411 | 367 | If set to 'horizontal', the resulting windows will be on stacked on top of |
|
412 | 368 | one another. If set to 'vertical', the resulting windows will be |
|
413 | 369 | side-by-side. If not set, it defaults to 'horizontal' for all but |
|
414 |
|
|
|
370 | HGVimDiff windows. | |
|
415 | 371 | |
|
416 |
5.2 |
|
|
372 | 5.2 HGCommand events *hgcommand-events* | |
|
417 | 373 | |
|
418 |
For additional customization, |
|
|
374 | For additional customization, HGCommand can trigger user-defined events. | |
|
419 | 375 | Event handlers are provided by defining User event autocommands (see |
|
420 |
|autocommand|, |User|) in the |
|
|
376 | |autocommand|, |User|) in the HGCommand group with patterns matching the | |
|
421 | 377 | event name. |
|
422 | 378 | |
|
423 | 379 | For instance, the following could be added to the vimrc to provide a 'q' |
|
424 |
mapping to quit a |
|
|
380 | mapping to quit a HGCommand scratch buffer: | |
|
425 | 381 | |
|
426 |
augroup |
|
|
427 |
au |
|
|
382 | augroup HGCommand | |
|
383 | au HGCommand User HGBufferCreated silent! nmap <unique> <buffer> q: bwipeout<cr> | |
|
428 | 384 | augroup END |
|
429 | 385 | |
|
430 | 386 | The following hooks are available: |
|
431 | 387 | |
|
432 |
|
|
|
388 | HGBufferCreated This event is fired just after a hg command | |
|
433 | 389 | result buffer is created and filled with the |
|
434 |
result of a |
|
|
435 |
the context of the |
|
|
436 |
|
|
|
390 | result of a hg command. It is executed within | |
|
391 | the context of the HG command buffer. The | |
|
392 | HGCommand buffer variables may be useful for | |
|
437 | 393 | handlers of this event (please see |
|
438 |
| |
|
|
394 | |hgcommand-buffer-variables|). | |
|
439 | 395 | |
|
440 |
|
|
|
396 | HGBufferSetup This event is fired just after HG buffer setup | |
|
441 | 397 | occurs, if enabled. |
|
442 | 398 | |
|
443 |
|
|
|
399 | HGPluginInit This event is fired when the HGCommand plugin | |
|
444 | 400 | first loads. |
|
445 | 401 | |
|
446 |
|
|
|
402 | HGPluginFinish This event is fired just after the HGCommand | |
|
447 | 403 | plugin loads. |
|
448 | 404 | |
|
449 |
|
|
|
405 | HGVimDiffFinish This event is fired just after the HGVimDiff | |
|
450 | 406 | command executes to allow customization of, |
|
451 | 407 | for instance, window placement and focus. |
|
452 | 408 | |
|
453 |
5.3 |
|
|
409 | 5.3 HGCommand buffer naming *hgcommand-naming* | |
|
454 | 410 | |
|
455 |
By default, the buffers containing the result of |
|
|
411 | By default, the buffers containing the result of HG commands are nameless | |
|
456 | 412 | scratch buffers. It is intended that buffer variables of those buffers be |
|
457 | 413 | used to customize the statusline option so that the user may fully control the |
|
458 | 414 | display of result buffers. |
|
459 | 415 | |
|
460 | 416 | If the old-style naming is desired, please enable the |
|
461 |
| |
|
|
462 |
a unique name that includes the source file name, the |
|
|
417 | |HGCommandNameResultBuffers| variable. Then, each result buffer will receive | |
|
418 | a unique name that includes the source file name, the HG command, and any | |
|
463 | 419 | extra data (such as revision numbers) that were part of the command. |
|
464 | 420 | |
|
465 |
5.4 |
|
|
421 | 5.4 HGCommand status line support *hgcommand-statusline* | |
|
466 | 422 | |
|
467 | 423 | It is intended that the user will customize the |'statusline'| option to |
|
468 |
include |
|
|
469 |
the |'statusline'| option is provided by the plugin, |
|
|
424 | include HG result buffer attributes. A sample function that may be used in | |
|
425 | the |'statusline'| option is provided by the plugin, HGGetStatusLine(). In | |
|
470 | 426 | order to use that function in the status line, do something like the |
|
471 | 427 | following: |
|
472 | 428 | |
|
473 |
set statusline=%<%f\ %{ |
|
|
429 | set statusline=%<%f\ %{HGGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P | |
|
474 | 430 | |
|
475 |
of which %{ |
|
|
431 | of which %{HGGetStatusLine()} is the relevant portion. | |
|
476 | 432 | |
|
477 |
The sample |
|
|
478 |
|
|
|
479 |
| |
|
|
433 | The sample HGGetStatusLine() function handles both HG result buffers and | |
|
434 | HG-managed files if HGCommand buffer management is enabled (please see | |
|
435 | |hgcommand-buffer-management|). | |
|
480 | 436 | |
|
481 |
5.5 |
|
|
437 | 5.5 HGCommand buffer management *hgcommand-buffer-management* | |
|
482 | 438 | |
|
483 |
The |
|
|
484 |
it attempts to set two buffer variables (' |
|
|
485 |
entry into a buffer. This is rather slow because it means that ' |
|
|
439 | The HGCommand plugin can operate in buffer management mode, which means that | |
|
440 | it attempts to set two buffer variables ('HGRevision' and 'HGBranch') upon | |
|
441 | entry into a buffer. This is rather slow because it means that 'hg status' | |
|
486 | 442 | will be invoked at each entry into a buffer (during the |BufEnter| |
|
487 | 443 | autocommand). |
|
488 | 444 | |
|
489 | 445 | This mode is disabled by default. In order to enable it, set the |
|
490 |
| |
|
|
446 | |HGCommandEnableBufferSetup| variable to a true (non-zero) value. Enabling | |
|
491 | 447 | this mode simply provides the buffer variables mentioned above. The user must |
|
492 | 448 | explicitly include those in the |'statusline'| option if they are to appear in |
|
493 |
the status line (but see | |
|
|
449 | the status line (but see |hgcommand-statusline| for a simple way to do that). | |
|
494 | 450 | |
|
495 | 451 | ============================================================================== |
|
496 | 452 | |
|
497 |
6. SSH "integration" * |
|
|
453 | 6. SSH "integration" *hgcommand-ssh* | |
|
498 | 454 | |
|
499 | 455 | The following instructions are intended for use in integrating the |
|
500 |
|
|
|
456 | hgcommand.vim plugin with an SSH-based HG environment. | |
|
501 | 457 | |
|
502 |
Familiarity with SSH and |
|
|
458 | Familiarity with SSH and HG are assumed. | |
|
503 | 459 | |
|
504 | 460 | These instructions assume that the intent is to have a message box pop up in |
|
505 | 461 | order to allow the user to enter a passphrase. If, instead, the user is |
@@ -507,18 +463,18 b' comfortable using certificate-based auth' | |||
|
507 | 463 | 6.1.1 and 6.1.2 (and optionally 6.1.4) need to be followed; ssh should then |
|
508 | 464 | work transparently. |
|
509 | 465 | |
|
510 |
6.1 Environment settings * |
|
|
466 | 6.1 Environment settings *hgcommand-ssh-env* | |
|
511 | 467 | |
|
512 |
6.1.1 |
|
|
468 | 6.1.1 HGROOT should be set to something like: | |
|
513 | 469 | |
|
514 | 470 | :ext:user@host:/path_to_repository |
|
515 | 471 | |
|
516 |
6.1.2 |
|
|
472 | 6.1.2 HG_RSH should be set to: | |
|
517 | 473 | |
|
518 | 474 | ssh |
|
519 | 475 | |
|
520 |
Together, those settings tell |
|
|
521 |
performing |
|
|
476 | Together, those settings tell HG to use ssh as the transport when | |
|
477 | performing HG calls. | |
|
522 | 478 | |
|
523 | 479 | 6.1.3 SSH_ASKPASS should be set to the password-dialog program. In my case, |
|
524 | 480 | running gnome, it's set to: |
@@ -527,14 +483,14 b' 6.1.3 SSH_ASKPASS should be set to the p' | |||
|
527 | 483 | |
|
528 | 484 | This tells SSH how to get passwords if no input is available. |
|
529 | 485 | |
|
530 |
6.1.4 OPTIONAL. You may need to set SSH_SERVER to the location of the |
|
|
486 | 6.1.4 OPTIONAL. You may need to set SSH_SERVER to the location of the hg | |
|
531 | 487 | executable on the remote (server) machine. |
|
532 | 488 | |
|
533 |
6.2 |
|
|
489 | 6.2 HG wrapper program *hgcommand-ssh-wrapper* | |
|
534 | 490 | |
|
535 | 491 | Now you need to convince SSH to use the password-dialog program. This means |
|
536 |
you need to execute SSH (and therefore |
|
|
537 |
following script is a simple perl wrapper that dissasociates the |
|
|
492 | you need to execute SSH (and therefore HG) without standard input. The | |
|
493 | following script is a simple perl wrapper that dissasociates the HG command | |
|
538 | 494 | from the current terminal. Specific steps to do this may vary from system to |
|
539 | 495 | system; the following example works for me on linux. |
|
540 | 496 | |
@@ -544,34 +500,34 b' use POSIX qw(setsid);' | |||
|
544 | 500 | open STDIN, '/dev/null'; |
|
545 | 501 | fork and do {wait; exit;}; |
|
546 | 502 | setsid; |
|
547 |
exec(' |
|
|
503 | exec('hg', @ARGV); | |
|
548 | 504 | |
|
549 |
6.3 Configuring |
|
|
505 | 6.3 Configuring hgcommand.vim *hgcommand-ssh-config* | |
|
550 | 506 | |
|
551 |
At this point, you should be able to use your wrapper script to invoke |
|
|
552 |
various commands, and get the password dialog. All that's left is to make |
|
|
507 | At this point, you should be able to use your wrapper script to invoke HG with | |
|
508 | various commands, and get the password dialog. All that's left is to make HG | |
|
553 | 509 | use your newly-created wrapper script. |
|
554 | 510 | |
|
555 |
6.3.1 Tell |
|
|
511 | 6.3.1 Tell hgcommand.vim what HG executable to use. The easiest way to do this | |
|
556 | 512 | is globally, by putting the following in your .vimrc: |
|
557 | 513 | |
|
558 |
let |
|
|
514 | let HGCommandHGExec=/path/to/hg/wrapper/script | |
|
559 | 515 | |
|
560 |
6.4 Where to go from here * |
|
|
516 | 6.4 Where to go from here *hgcommand-ssh-other* | |
|
561 | 517 | |
|
562 |
The script given above works even when non-SSH |
|
|
563 |
except possibly when interactively entering the message for |
|
|
564 |
(depending on the editor you use... VIM works fine). Since the |
|
|
518 | The script given above works even when non-SSH HG connections are used, | |
|
519 | except possibly when interactively entering the message for HG commit log | |
|
520 | (depending on the editor you use... VIM works fine). Since the hgcommand.vim | |
|
565 | 521 | plugin handles that message without a terminal, the wrapper script can be used |
|
566 | 522 | all the time. |
|
567 | 523 | |
|
568 |
This allows mixed-mode operation, where some work is done with SSH-based |
|
|
524 | This allows mixed-mode operation, where some work is done with SSH-based HG | |
|
569 | 525 | repositories, and others with pserver or local access. |
|
570 | 526 | |
|
571 | 527 | It is possible, though beyond the scope of the plugin, to dynamically set the |
|
572 |
|
|
|
573 |
events provided (such as |
|
|
574 |
set a buffer-local value (b: |
|
|
528 | HG executable based on the HGROOT for the file being edited. The user | |
|
529 | events provided (such as HGBufferCreated and HGBufferSetup) can be used to | |
|
530 | set a buffer-local value (b:HGCommandHGExec) to override the HG executable | |
|
575 | 531 | on a file-by-file basis. Alternatively, much the same can be done (less |
|
576 | 532 | automatically) by the various project-oriented plugins out there. |
|
577 | 533 | |
@@ -580,11 +536,11 b' or ssh-agent are employed so that the us' | |||
|
580 | 536 | too often. |
|
581 | 537 | |
|
582 | 538 | ============================================================================== |
|
583 |
9. Tips * |
|
|
539 | 9. Tips *hgcommand-tips* | |
|
584 | 540 | |
|
585 | 541 | 9.1 Split window annotation, by Michael Anderson |
|
586 | 542 | |
|
587 |
:nmap <Leader> |
|
|
543 | :nmap <Leader>hgN :vs<CR><C-w>h<Leader>hgn:vertical res 40<CR> | |
|
588 | 544 | \ggdddd:set scb<CR>:set nowrap<CR><C-w>lgg:set scb<CR> |
|
589 | 545 | \:set nowrap<CR> |
|
590 | 546 | |
@@ -599,17 +555,11 b' 3) Your own code still has syntax highli' | |||
|
599 | 555 | |
|
600 | 556 | ============================================================================== |
|
601 | 557 | |
|
602 |
8. Known bugs * |
|
|
558 | 8. Known bugs *hgcommand-bugs* | |
|
603 | 559 | |
|
604 | 560 | Please let me know if you run across any. |
|
605 | 561 | |
|
606 | CVSUnedit may, if a file is changed from the repository, provide prompt text | |
|
607 | to determine whether the changes should be thrown away. Currently, that text | |
|
608 | shows up in the CVS result buffer as information; there is no way for the user | |
|
609 | to actually respond to the prompt and the CVS unedit command does nothing. If | |
|
610 | this really bothers anyone, please let me know. | |
|
611 | ||
|
612 | CVSVimDiff, when using the original (real) source buffer as one of the diff | |
|
562 | HGVimDiff, when using the original (real) source buffer as one of the diff | |
|
613 | 563 | buffers, uses some hacks to try to restore the state of the original buffer |
|
614 | 564 | when the scratch buffer containing the other version is destroyed. There may |
|
615 | 565 | still be bugs in here, depending on many configuration details. |
This diff has been collapsed as it changes many lines, (1018 lines changed) Show them Hide them | |||
@@ -1,77 +1,44 b'' | |||
|
1 | 1 | " vim600: set foldmethod=marker: |
|
2 | 2 | " |
|
3 |
" Vim plugin to assist in working with |
|
|
3 | " Vim plugin to assist in working with HG-controlled files. | |
|
4 | 4 | " |
|
5 | 5 | " Last Change: 2006/02/22 |
|
6 | 6 | " Version: 1.76 |
|
7 | " Maintainer: Bob Hiestand <bob.hiestand@gmail.com> | |
|
7 | " Maintainer: Mathieu Clabaut <mathieu.clabaut@gmail.com> | |
|
8 | 8 | " License: This file is placed in the public domain. |
|
9 | 9 | " Credits: {{{1 |
|
10 | " Mathieu Clabaut for many suggestions and improvements. | |
|
11 | " | |
|
12 | " Suresh Govindachar and Jeeva Chelladhurai for finding waaaay | |
|
13 | " too many bugs. | |
|
14 | " | |
|
15 | " Suresh Govindachar (again!) for finding the | |
|
16 | " fully-folded-last-line-delete bug. | |
|
17 | " | |
|
18 | " Albrecht Gass for the Delete-on-Hide behavior suggestion. | |
|
19 | " | |
|
20 | " Joe MacDonald for finding the CVS log message header bug and | |
|
21 | " pointing out that buffer refreshes are needed after CVS | |
|
22 | " \%(un\)\?edit. | |
|
23 | " | |
|
24 | " Srinath Avadhanula for the suggestion and original patch for | |
|
25 | " the CVSCommitOnWrite option and mapping hot key. | |
|
26 | " | |
|
27 | " John Sivak for helping to debug Windows issues and suggesting | |
|
28 | " the CVSEditors and CVSWatchers commands. | |
|
29 | " | |
|
30 | " Igor Levko for the patch to recognize numerical sticky tags. | |
|
31 | " | |
|
32 | " Domink Strasser for the patch to correct the status line for | |
|
33 | " CVSAdd'd files. | |
|
34 | " | |
|
35 | " Weerapong Sirikanya for finding a bug with CVSCommit and | |
|
36 | " autochdir. | |
|
37 | " | |
|
38 | " David Gotz for finding a bug with CVSVimDiff buffer splitting | |
|
39 | " and original buffer restoration. | |
|
40 | " | |
|
41 | " CJ van den Berg for the patch to not change working directory | |
|
42 | " when editing a non-CVS file. | |
|
43 | " | |
|
44 | " Luca Gerli for noticing bad behavior for keywords in files | |
|
45 | " after commit if split windows are used. | |
|
10 | " Bob Hiestand <bob.hiestand@gmail.com> for the fabulous | |
|
11 | " cvscommand.vim from which this script was directly created by | |
|
12 | " means of sed commands and minor tweaks. | |
|
46 | 13 | |
|
47 | 14 | " Section: Documentation {{{1 |
|
48 | 15 | " |
|
49 |
" Provides functions to invoke various |
|
|
16 | " Provides functions to invoke various HG commands on the current file | |
|
50 | 17 | " (either the current buffer, or, in the case of an directory buffer, the file |
|
51 | 18 | " on the current line). The output of the commands is captured in a new |
|
52 |
" scratch window. For convenience, if the functions are invoked on a |
|
|
53 |
" output window, the original file is used for the |
|
|
54 |
" the window is split. This is primarily useful when running |
|
|
55 |
" you need to see the changes made, so that |
|
|
19 | " scratch window. For convenience, if the functions are invoked on a HG | |
|
20 | " output window, the original file is used for the hg operation instead after | |
|
21 | " the window is split. This is primarily useful when running HGCommit and | |
|
22 | " you need to see the changes made, so that HGDiff is usable and shows up in | |
|
56 | 23 | " another window. |
|
57 | 24 | " |
|
58 | 25 | " Command documentation {{{2 |
|
59 | 26 | " |
|
60 |
" |
|
|
27 | " HGAdd Performs "hg add" on the current file. | |
|
61 | 28 | " |
|
62 |
" |
|
|
29 | " HGAnnotate Performs "hg annotate" on the current file. If an | |
|
63 | 30 | " argument is given, the argument is used as a revision |
|
64 | 31 | " number to display. If not given an argument, it uses the |
|
65 | 32 | " most recent version of the file on the current branch. |
|
66 |
" Additionally, if the current buffer is a |
|
|
33 | " Additionally, if the current buffer is a HGAnnotate buffer | |
|
67 | 34 | " already, the version number on the current line is used. |
|
68 | 35 | " |
|
69 |
" If the ' |
|
|
36 | " If the 'HGCommandAnnotateParent' variable is set to a | |
|
70 | 37 | " non-zero value, the version previous to the one on the |
|
71 | 38 | " current line is used instead. This allows one to navigate |
|
72 | 39 | " back to examine the previous version of a line. |
|
73 | 40 | " |
|
74 |
" |
|
|
41 | " HGCommit[!] If called with arguments, this performs "hg commit" using | |
|
75 | 42 | " the arguments as the log message. |
|
76 | 43 | " |
|
77 | 44 | " If '!' is used, an empty log message is committed. |
@@ -83,40 +50,34 b'' | |||
|
83 | 50 | " message. The commit can be abandoned if the log message |
|
84 | 51 | " buffer is deleted or wiped before being written. |
|
85 | 52 | " |
|
86 |
" |
|
|
87 |
" file. With one argument, " |
|
|
53 | " HGDiff With no arguments, this performs "hg diff" on the current | |
|
54 | " file. With one argument, "hg diff" is performed on the | |
|
88 | 55 | " current file against the specified revision. With two |
|
89 |
" arguments, |
|
|
56 | " arguments, hg diff is performed between the specified | |
|
90 | 57 | " revisions of the current file. This command uses the |
|
91 |
" ' |
|
|
58 | " 'HGCommandDiffOpt' variable to specify diff options. If | |
|
92 | 59 | " that variable does not exist, then 'wbBc' is assumed. If |
|
93 | 60 | " you wish to have no options, then set it to the empty |
|
94 | 61 | " string. |
|
95 | 62 | " |
|
96 | " CVSEdit Performs "cvs edit" on the current file. | |
|
97 | " | |
|
98 | " CVSEditors Performs "cvs editors" on the current file. | |
|
63 | " HGGotoOriginal Returns the current window to the source buffer if the | |
|
64 | " current buffer is a HG output buffer. | |
|
99 | 65 | " |
|
100 | " CVSGotoOriginal Returns the current window to the source buffer if the | |
|
101 | " current buffer is a CVS output buffer. | |
|
66 | " HGLog Performs "hg log" on the current file. | |
|
102 | 67 | " |
|
103 | " CVSLog Performs "cvs log" on the current file. | |
|
104 | " | |
|
105 | " CVSRevert Replaces the modified version of the current file with the | |
|
68 | " HGRevert Replaces the modified version of the current file with the | |
|
106 | 69 | " most recent version from the repository. |
|
107 | 70 | " |
|
108 |
" |
|
|
71 | " HGReview Retrieves a particular version of the current file. If no | |
|
109 | 72 | " argument is given, the most recent version of the file on |
|
110 | 73 | " the current branch is retrieved. The specified revision is |
|
111 | 74 | " retrieved into a new buffer. |
|
112 | 75 | " |
|
113 |
" |
|
|
114 | " | |
|
115 | " CVSUnedit Performs "cvs unedit" on the current file. | |
|
76 | " HGStatus Performs "hg status" on the current file. | |
|
116 | 77 | " |
|
117 |
" |
|
|
78 | " HGUpdate Performs "hg update" on the current file. | |
|
118 | 79 | " |
|
119 |
" |
|
|
80 | " HGVimDiff With no arguments, this prompts the user for a revision and | |
|
120 | 81 | " then uses vimdiff to display the differences between the |
|
121 | 82 | " current file and the specified revision. If no revision is |
|
122 | 83 | " specified, the most recent version of the file on the |
@@ -139,171 +100,150 b'' | |||
|
139 | 100 | " command on a different file will close the previous vimdiff |
|
140 | 101 | " buffers. |
|
141 | 102 | " |
|
142 | " CVSWatch Takes an argument which must be one of [on|off|add|remove]. | |
|
143 | " Performs "cvs watch" with the given argument on the current | |
|
144 | " file. | |
|
145 | " | |
|
146 | " CVSWatchers Performs "cvs watchers" on the current file. | |
|
147 | " | |
|
148 | " CVSWatchAdd Alias for "CVSWatch add" | |
|
149 | " | |
|
150 | " CVSWatchOn Alias for "CVSWatch on" | |
|
151 | " | |
|
152 | " CVSWatchOff Alias for "CVSWatch off" | |
|
153 | " | |
|
154 | " CVSWatchRemove Alias for "CVSWatch remove" | |
|
155 | 103 | " |
|
156 | 104 | " Mapping documentation: {{{2 |
|
157 | 105 | " |
|
158 | 106 | " By default, a mapping is defined for each command. User-provided mappings |
|
159 | 107 | " can be used instead by mapping to <Plug>CommandName, for instance: |
|
160 | 108 | " |
|
161 |
" nnoremap ,ca <Plug> |
|
|
109 | " nnoremap ,ca <Plug>HGAdd | |
|
162 | 110 | " |
|
163 | 111 | " The default mappings are as follow: |
|
164 | 112 | " |
|
165 |
" <Leader> |
|
|
166 |
" <Leader> |
|
|
167 |
" <Leader> |
|
|
168 |
" <Leader> |
|
|
169 | " <Leader>ce CVSEdit | |
|
170 | " <Leader>ci CVSEditors | |
|
171 |
" <Leader> |
|
|
172 | " <Leader>cG CVSGotoOriginal! | |
|
173 |
" <Leader> |
|
|
174 | " <Leader>cr CVSReview | |
|
175 | " <Leader>cs CVSStatus | |
|
176 | " <Leader>ct CVSUnedit | |
|
177 | " <Leader>cu CVSUpdate | |
|
178 | " <Leader>cv CVSVimDiff | |
|
179 | " <Leader>cwv CVSWatchers | |
|
180 | " <Leader>cwa CVSWatchAdd | |
|
181 | " <Leader>cwn CVSWatchOn | |
|
182 | " <Leader>cwa CVSWatchOff | |
|
183 | " <Leader>cwr CVSWatchRemove | |
|
113 | " <Leader>hga HGAdd | |
|
114 | " <Leader>hgn HGAnnotate | |
|
115 | " <Leader>hgc HGCommit | |
|
116 | " <Leader>hgd HGDiff | |
|
117 | " <Leader>hgg HGGotoOriginal | |
|
118 | " <Leader>hgG HGGotoOriginal! | |
|
119 | " <Leader>hgl HGLog | |
|
120 | " <Leader>hgr HGReview | |
|
121 | " <Leader>hgs HGStatus | |
|
122 | " <Leader>hgu HGUpdate | |
|
123 | " <Leader>hgv HGVimDiff | |
|
184 | 124 | " |
|
185 | 125 | " Options documentation: {{{2 |
|
186 | 126 | " |
|
187 | 127 | " Several variables are checked by the script to determine behavior as follow: |
|
188 | 128 | " |
|
189 |
" |
|
|
129 | " HGCommandAnnotateParent | |
|
190 | 130 | " This variable, if set to a non-zero value, causes the zero-argument form |
|
191 |
" of |
|
|
131 | " of HGAnnotate when invoked on a HGAnnotate buffer to go to the version | |
|
192 | 132 | " previous to that displayed on the current line. If not set, it defaults |
|
193 | 133 | " to 0. |
|
194 | 134 | " |
|
195 |
" |
|
|
196 |
" This variable, if set to a non-zero value, causes the pending |
|
|
135 | " HGCommandCommitOnWrite | |
|
136 | " This variable, if set to a non-zero value, causes the pending hg commit | |
|
197 | 137 | " to take place immediately as soon as the log message buffer is written. |
|
198 |
" If set to zero, only the |
|
|
138 | " If set to zero, only the HGCommit mapping will cause the pending commit | |
|
199 | 139 | " to occur. If not set, it defaults to 1. |
|
200 | 140 | " |
|
201 |
" |
|
|
202 |
" This variable, if set to a non-zero value, causes the temporary |
|
|
141 | " HGCommandDeleteOnHide | |
|
142 | " This variable, if set to a non-zero value, causes the temporary HG result | |
|
203 | 143 | " buffers to automatically delete themselves when hidden. |
|
204 | 144 | " |
|
205 |
" |
|
|
145 | " HGCommandDiffOpt | |
|
206 | 146 | " This variable, if set, determines the options passed to the diff command |
|
207 |
" of |
|
|
147 | " of HG. If not set, it defaults to 'wbBc'. | |
|
208 | 148 | " |
|
209 |
" |
|
|
210 |
" This variable overrides the |
|
|
211 |
" created with |
|
|
149 | " HGCommandDiffSplit | |
|
150 | " This variable overrides the HGCommandSplit variable, but only for buffers | |
|
151 | " created with HGVimDiff. | |
|
212 | 152 | " |
|
213 |
" |
|
|
153 | " HGCommandEdit | |
|
214 | 154 | " This variable controls whether the original buffer is replaced ('edit') or |
|
215 | 155 | " split ('split'). If not set, it defaults to 'edit'. |
|
216 | 156 | " |
|
217 |
" |
|
|
218 |
" This variable, if set to a non-zero value, activates |
|
|
219 |
" mode. This mode means that two buffer variables, ' |
|
|
220 |
" ' |
|
|
157 | " HGCommandEnableBufferSetup | |
|
158 | " This variable, if set to a non-zero value, activates HG buffer management | |
|
159 | " mode. This mode means that two buffer variables, 'HGRevision' and | |
|
160 | " 'HGBranch', are set if the file is HG-controlled. This is useful for | |
|
221 | 161 | " displaying version information in the status bar. |
|
222 | 162 | " |
|
223 |
" |
|
|
163 | " HGCommandInteractive | |
|
224 | 164 | " This variable, if set to a non-zero value, causes appropriate functions (for |
|
225 |
" the moment, only |
|
|
165 | " the moment, only HGReview) to query the user for a revision to use | |
|
226 | 166 | " instead of the current revision if none is specified. |
|
227 | 167 | " |
|
228 |
" |
|
|
168 | " HGCommandNameMarker | |
|
229 | 169 | " This variable, if set, configures the special attention-getting characters |
|
230 |
" that appear on either side of the |
|
|
231 |
" This has no effect unless ' |
|
|
170 | " that appear on either side of the hg buffer type in the buffer name. | |
|
171 | " This has no effect unless 'HGCommandNameResultBuffers' is set to a true | |
|
232 | 172 | " value. If not set, it defaults to '_'. |
|
233 | 173 | " |
|
234 |
" |
|
|
235 |
" This variable, if set to a true value, causes the |
|
|
236 |
" named in the old way ('<source file name> _< |
|
|
174 | " HGCommandNameResultBuffers | |
|
175 | " This variable, if set to a true value, causes the hg result buffers to be | |
|
176 | " named in the old way ('<source file name> _<hg command>_'). If not set | |
|
237 | 177 | " or set to a false value, the result buffer is nameless. |
|
238 | 178 | " |
|
239 |
" |
|
|
179 | " HGCommandSplit | |
|
240 | 180 | " This variable controls the orientation of the various window splits that |
|
241 |
" may occur (such as with |
|
|
242 |
" command buffer, or when the ' |
|
|
181 | " may occur (such as with HGVimDiff, when using a HG command on a HG | |
|
182 | " command buffer, or when the 'HGCommandEdit' variable is set to 'split'. | |
|
243 | 183 | " If set to 'horizontal', the resulting windows will be on stacked on top of |
|
244 | 184 | " one another. If set to 'vertical', the resulting windows will be |
|
245 | 185 | " side-by-side. If not set, it defaults to 'horizontal' for all but |
|
246 |
" |
|
|
186 | " HGVimDiff windows. | |
|
247 | 187 | " |
|
248 | 188 | " Event documentation {{{2 |
|
249 |
" For additional customization, |
|
|
250 |
" hooks. Each event is in the |
|
|
189 | " For additional customization, hgcommand.vim uses User event autocommand | |
|
190 | " hooks. Each event is in the HGCommand group, and different patterns | |
|
251 | 191 | " match the various hooks. |
|
252 | 192 | " |
|
253 | 193 | " For instance, the following could be added to the vimrc to provide a 'q' |
|
254 |
" mapping to quit a |
|
|
194 | " mapping to quit a HG buffer: | |
|
255 | 195 | " |
|
256 |
" augroup |
|
|
257 |
" au |
|
|
196 | " augroup HGCommand | |
|
197 | " au HGCommand User HGBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr> | |
|
258 | 198 | " augroup END |
|
259 | 199 | " |
|
260 | 200 | " The following hooks are available: |
|
261 | 201 | " |
|
262 |
" |
|
|
202 | " HGBufferCreated This event is fired just after a hg command | |
|
263 | 203 | " result buffer is created and filled with the |
|
264 |
" result of a |
|
|
204 | " result of a hg command. It is executed within | |
|
265 | 205 | " the context of the new buffer. |
|
266 | 206 | " |
|
267 |
" |
|
|
207 | " HGBufferSetup This event is fired just after HG buffer setup | |
|
268 | 208 | " occurs, if enabled. |
|
269 | 209 | " |
|
270 |
" |
|
|
210 | " HGPluginInit This event is fired when the HGCommand plugin | |
|
271 | 211 | " first loads. |
|
272 | 212 | " |
|
273 |
" |
|
|
213 | " HGPluginFinish This event is fired just after the HGCommand | |
|
274 | 214 | " plugin loads. |
|
275 | 215 | " |
|
276 |
" |
|
|
216 | " HGVimDiffFinish This event is fired just after the HGVimDiff | |
|
277 | 217 | " command executes to allow customization of, |
|
278 | 218 | " for instance, window placement and focus. |
|
279 | 219 | " |
|
280 | 220 | " Section: Plugin header {{{1 |
|
281 | 221 | |
|
282 |
" loaded_ |
|
|
222 | " loaded_hgcommand is set to 1 when the initialization begins, and 2 when it | |
|
283 | 223 | " completes. This allows various actions to only be taken by functions after |
|
284 | 224 | " system initialization. |
|
285 | 225 | |
|
286 |
if exists("loaded_ |
|
|
226 | if exists("loaded_hgcommand") | |
|
287 | 227 | finish |
|
288 | 228 | endif |
|
289 |
let loaded_ |
|
|
229 | let loaded_hgcommand = 1 | |
|
290 | 230 | |
|
291 | 231 | if v:version < 602 |
|
292 |
echohl WarningMsg|echomsg " |
|
|
232 | echohl WarningMsg|echomsg "HGCommand 1.69 or later requires VIM 6.2 or later"|echohl None | |
|
293 | 233 | finish |
|
294 | 234 | endif |
|
295 | 235 | |
|
296 | 236 | " Section: Event group setup {{{1 |
|
297 | 237 | |
|
298 |
augroup |
|
|
238 | augroup HGCommand | |
|
299 | 239 | augroup END |
|
300 | 240 | |
|
301 | 241 | " Section: Plugin initialization {{{1 |
|
302 |
silent do |
|
|
242 | silent do HGCommand User HGPluginInit | |
|
303 | 243 | |
|
304 | 244 | " Section: Script variable initialization {{{1 |
|
305 | 245 | |
|
306 |
let s: |
|
|
246 | let s:HGCommandEditFileRunning = 0 | |
|
307 | 247 | unlet! s:vimDiffRestoreCmd |
|
308 | 248 | unlet! s:vimDiffSourceBuffer |
|
309 | 249 | unlet! s:vimDiffBufferCount |
@@ -311,24 +251,24 b' unlet! s:vimDiffScratchList' | |||
|
311 | 251 | |
|
312 | 252 | " Section: Utility functions {{{1 |
|
313 | 253 | |
|
314 |
" Function: s: |
|
|
254 | " Function: s:HGResolveLink() {{{2 | |
|
315 | 255 | " Fully resolve the given file name to remove shortcuts or symbolic links. |
|
316 | 256 | |
|
317 |
function! s: |
|
|
257 | function! s:HGResolveLink(fileName) | |
|
318 | 258 | let resolved = resolve(a:fileName) |
|
319 | 259 | if resolved != a:fileName |
|
320 |
let resolved = s: |
|
|
260 | let resolved = s:HGResolveLink(resolved) | |
|
321 | 261 | endif |
|
322 | 262 | return resolved |
|
323 | 263 | endfunction |
|
324 | 264 | |
|
325 |
" Function: s: |
|
|
326 |
" Go to the directory in which the current |
|
|
327 |
" If this is a |
|
|
265 | " Function: s:HGChangeToCurrentFileDir() {{{2 | |
|
266 | " Go to the directory in which the current HG-controlled file is located. | |
|
267 | " If this is a HG command buffer, first switch to the original file. | |
|
328 | 268 | |
|
329 |
function! s: |
|
|
269 | function! s:HGChangeToCurrentFileDir(fileName) | |
|
330 | 270 | let oldCwd=getcwd() |
|
331 |
let fileName=s: |
|
|
271 | let fileName=s:HGResolveLink(a:fileName) | |
|
332 | 272 | let newCwd=fnamemodify(fileName, ':h') |
|
333 | 273 | if strlen(newCwd) > 0 |
|
334 | 274 | execute 'cd' escape(newCwd, ' ') |
@@ -336,11 +276,11 b' function! s:CVSChangeToCurrentFileDir(fi' | |||
|
336 | 276 | return oldCwd |
|
337 | 277 | endfunction |
|
338 | 278 | |
|
339 |
" Function: s: |
|
|
279 | " Function: s:HGGetOption(name, default) {{{2 | |
|
340 | 280 | " Grab a user-specified option to override the default provided. Options are |
|
341 | 281 | " searched in the window, buffer, then global spaces. |
|
342 | 282 | |
|
343 |
function! s: |
|
|
283 | function! s:HGGetOption(name, default) | |
|
344 | 284 | if exists("s:" . a:name . "Override") |
|
345 | 285 | execute "return s:".a:name."Override" |
|
346 | 286 | elseif exists("w:" . a:name) |
@@ -354,19 +294,19 b' function! s:CVSGetOption(name, default)' | |||
|
354 | 294 | endif |
|
355 | 295 | endfunction |
|
356 | 296 | |
|
357 |
" Function: s: |
|
|
297 | " Function: s:HGEditFile(name, origBuffNR) {{{2 | |
|
358 | 298 | " Wrapper around the 'edit' command to provide some helpful error text if the |
|
359 | 299 | " current buffer can't be abandoned. If name is provided, it is used; |
|
360 | 300 | " otherwise, a nameless scratch buffer is used. |
|
361 | 301 | " Returns: 0 if successful, -1 if an error occurs. |
|
362 | 302 | |
|
363 |
function! s: |
|
|
303 | function! s:HGEditFile(name, origBuffNR) | |
|
364 | 304 | "Name parameter will be pasted into expression. |
|
365 | 305 | let name = escape(a:name, ' *?\') |
|
366 | 306 | |
|
367 |
let editCommand = s: |
|
|
307 | let editCommand = s:HGGetOption('HGCommandEdit', 'edit') | |
|
368 | 308 | if editCommand != 'edit' |
|
369 |
if s: |
|
|
309 | if s:HGGetOption('HGCommandSplit', 'horizontal') == 'horizontal' | |
|
370 | 310 | if name == "" |
|
371 | 311 | let editCommand = 'rightbelow new' |
|
372 | 312 | else |
@@ -388,28 +328,28 b' function! s:CVSEditFile(name, origBuffNR' | |||
|
388 | 328 | endif |
|
389 | 329 | |
|
390 | 330 | " Protect against useless buffer set-up |
|
391 |
let s: |
|
|
331 | let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning + 1 | |
|
392 | 332 | try |
|
393 | 333 | execute editCommand |
|
394 | 334 | finally |
|
395 |
let s: |
|
|
335 | let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning - 1 | |
|
396 | 336 | endtry |
|
397 | 337 | |
|
398 |
let b: |
|
|
399 |
let b: |
|
|
338 | let b:HGOrigBuffNR=a:origBuffNR | |
|
339 | let b:HGCommandEdit='split' | |
|
400 | 340 | endfunction |
|
401 | 341 | |
|
402 |
" Function: s: |
|
|
342 | " Function: s:HGCreateCommandBuffer(cmd, cmdName, statusText, filename) {{{2 | |
|
403 | 343 | " Creates a new scratch buffer and captures the output from execution of the |
|
404 | 344 | " given command. The name of the scratch buffer is returned. |
|
405 | 345 | |
|
406 |
function! s: |
|
|
346 | function! s:HGCreateCommandBuffer(cmd, cmdName, statusText, origBuffNR) | |
|
407 | 347 | let fileName=bufname(a:origBuffNR) |
|
408 | 348 | |
|
409 | 349 | let resultBufferName='' |
|
410 | 350 | |
|
411 |
if s: |
|
|
412 |
let nameMarker = s: |
|
|
351 | if s:HGGetOption("HGCommandNameResultBuffers", 0) | |
|
352 | let nameMarker = s:HGGetOption("HGCommandNameMarker", '_') | |
|
413 | 353 | if strlen(a:statusText) > 0 |
|
414 | 354 | let bufName=a:cmdName . ' -- ' . a:statusText |
|
415 | 355 | else |
@@ -424,28 +364,29 b' function! s:CVSCreateCommandBuffer(cmd, ' | |||
|
424 | 364 | endwhile |
|
425 | 365 | endif |
|
426 | 366 | |
|
427 |
let |
|
|
428 | let cvsOut = system(cvsCommand) | |
|
367 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " " . a:cmd | |
|
368 | echomsg "DBG :".hgCommand | |
|
369 | let hgOut = system(hgCommand) | |
|
429 | 370 | " HACK: diff command does not return proper error codes |
|
430 |
if v:shell_error && a:cmdName != ' |
|
|
431 |
if strlen( |
|
|
432 |
echoerr " |
|
|
371 | if v:shell_error && a:cmdName != 'hgdiff' | |
|
372 | if strlen(hgOut) == 0 | |
|
373 | echoerr "HG command failed" | |
|
433 | 374 | else |
|
434 |
echoerr " |
|
|
375 | echoerr "HG command failed: " . hgOut | |
|
435 | 376 | endif |
|
436 | 377 | return -1 |
|
437 | 378 | endif |
|
438 |
if strlen( |
|
|
379 | if strlen(hgOut) == 0 | |
|
439 | 380 | " Handle case of no output. In this case, it is important to check the |
|
440 |
" file status, especially since |
|
|
381 | " file status, especially since hg edit/unedit may change the attributes | |
|
441 | 382 | " of the file with no visible output. |
|
442 | 383 | |
|
443 |
echomsg "No output from |
|
|
384 | echomsg "No output from HG command" | |
|
444 | 385 | checktime |
|
445 | 386 | return -1 |
|
446 | 387 | endif |
|
447 | 388 | |
|
448 |
if s: |
|
|
389 | if s:HGEditFile(resultBufferName, a:origBuffNR) == -1 | |
|
449 | 390 | return -1 |
|
450 | 391 | endif |
|
451 | 392 | |
@@ -453,11 +394,11 b' function! s:CVSCreateCommandBuffer(cmd, ' | |||
|
453 | 394 | set noswapfile |
|
454 | 395 | set filetype= |
|
455 | 396 | |
|
456 |
if s: |
|
|
397 | if s:HGGetOption("HGCommandDeleteOnHide", 0) | |
|
457 | 398 | set bufhidden=delete |
|
458 | 399 | endif |
|
459 | 400 | |
|
460 |
silent 0put= |
|
|
401 | silent 0put=hgOut | |
|
461 | 402 | |
|
462 | 403 | " The last command left a blank line at the end of the buffer. If the |
|
463 | 404 | " last line is folded (a side effect of the 'put') then the attempt to |
@@ -475,22 +416,22 b' function! s:CVSCreateCommandBuffer(cmd, ' | |||
|
475 | 416 | |
|
476 | 417 | " Define the environment and execute user-defined hooks. |
|
477 | 418 | |
|
478 |
let b: |
|
|
479 |
let b: |
|
|
419 | let b:HGSourceFile=fileName | |
|
420 | let b:HGCommand=a:cmdName | |
|
480 | 421 | if a:statusText != "" |
|
481 |
let b: |
|
|
422 | let b:HGStatusText=a:statusText | |
|
482 | 423 | endif |
|
483 | 424 | |
|
484 |
silent do |
|
|
425 | silent do HGCommand User HGBufferCreated | |
|
485 | 426 | return bufnr("%") |
|
486 | 427 | endfunction |
|
487 | 428 | |
|
488 |
" Function: s: |
|
|
489 |
" Attempts to locate the original file to which |
|
|
429 | " Function: s:HGBufferCheck(hgBuffer) {{{2 | |
|
430 | " Attempts to locate the original file to which HG operations were applied | |
|
490 | 431 | " for a given buffer. |
|
491 | 432 | |
|
492 |
function! s: |
|
|
493 |
let origBuffer = getbufvar(a: |
|
|
433 | function! s:HGBufferCheck(hgBuffer) | |
|
434 | let origBuffer = getbufvar(a:hgBuffer, "HGOrigBuffNR") | |
|
494 | 435 | if origBuffer |
|
495 | 436 | if bufexists(origBuffer) |
|
496 | 437 | return origBuffer |
@@ -500,52 +441,54 b' function! s:CVSBufferCheck(cvsBuffer)' | |||
|
500 | 441 | endif |
|
501 | 442 | else |
|
502 | 443 | " No original buffer |
|
503 |
return a: |
|
|
444 | return a:hgBuffer | |
|
504 | 445 | endif |
|
505 | 446 | endfunction |
|
506 | 447 | |
|
507 |
" Function: s: |
|
|
508 |
" Attempts to locate the original file to which |
|
|
448 | " Function: s:HGCurrentBufferCheck() {{{2 | |
|
449 | " Attempts to locate the original file to which HG operations were applied | |
|
509 | 450 | " for the current buffer. |
|
510 | 451 | |
|
511 |
function! s: |
|
|
512 |
return s: |
|
|
452 | function! s:HGCurrentBufferCheck() | |
|
453 | return s:HGBufferCheck(bufnr("%")) | |
|
513 | 454 | endfunction |
|
514 | 455 | |
|
515 |
" Function: s: |
|
|
516 |
" Toggles on and off the delete-on-hide behavior of |
|
|
456 | " Function: s:HGToggleDeleteOnHide() {{{2 | |
|
457 | " Toggles on and off the delete-on-hide behavior of HG buffers | |
|
517 | 458 | |
|
518 |
function! s: |
|
|
519 |
if exists("g: |
|
|
520 |
unlet g: |
|
|
459 | function! s:HGToggleDeleteOnHide() | |
|
460 | if exists("g:HGCommandDeleteOnHide") | |
|
461 | unlet g:HGCommandDeleteOnHide | |
|
521 | 462 | else |
|
522 |
let g: |
|
|
463 | let g:HGCommandDeleteOnHide=1 | |
|
523 | 464 | endif |
|
524 | 465 | endfunction |
|
525 | 466 | |
|
526 |
" Function: s: |
|
|
527 |
" General skeleton for |
|
|
467 | " Function: s:HGDoCommand(hgcmd, cmdName, statusText) {{{2 | |
|
468 | " General skeleton for HG function execution. | |
|
528 | 469 | " Returns: name of the new command buffer containing the command results |
|
529 | 470 | |
|
530 |
function! s: |
|
|
531 |
let |
|
|
532 |
if |
|
|
471 | function! s:HGDoCommand(cmd, cmdName, statusText) | |
|
472 | let hgBufferCheck=s:HGCurrentBufferCheck() | |
|
473 | if hgBufferCheck == -1 | |
|
533 | 474 | echo "Original buffer no longer exists, aborting." |
|
534 | 475 | return -1 |
|
535 | 476 | endif |
|
536 | 477 | |
|
537 |
let fileName=bufname( |
|
|
478 | let fileName=bufname(hgBufferCheck) | |
|
538 | 479 | if isdirectory(fileName) |
|
539 | 480 | let fileName=fileName . "/" . getline(".") |
|
540 | 481 | endif |
|
541 |
let realFileName = fnamemodify(s: |
|
|
542 |
let oldCwd=s: |
|
|
482 | let realFileName = fnamemodify(s:HGResolveLink(fileName), ':t') | |
|
483 | let oldCwd=s:HGChangeToCurrentFileDir(fileName) | |
|
543 | 484 | try |
|
544 | if !filereadable('CVS/Root') | |
|
545 | throw fileName . ' is not a CVS-controlled file.' | |
|
546 | endif | |
|
485 | " TODO | |
|
486 | "if !filereadable('HG/Root') | |
|
487 | "throw fileName . ' is not a HG-controlled file.' | |
|
488 | "endif | |
|
547 | 489 | let fullCmd = a:cmd . ' "' . realFileName . '"' |
|
548 | let resultBuffer=s:CVSCreateCommandBuffer(fullCmd, a:cmdName, a:statusText, cvsBufferCheck) | |
|
490 | "echomsg "DEBUG".fullCmd | |
|
491 | let resultBuffer=s:HGCreateCommandBuffer(fullCmd, a:cmdName, a:statusText, hgBufferCheck) | |
|
549 | 492 | return resultBuffer |
|
550 | 493 | catch |
|
551 | 494 | echoerr v:exception |
@@ -556,77 +499,89 b' function! s:CVSDoCommand(cmd, cmdName, s' | |||
|
556 | 499 | endfunction |
|
557 | 500 | |
|
558 | 501 | |
|
559 |
" Function: s: |
|
|
502 | " Function: s:HGGetStatusVars(revision, branch, repository) {{{2 | |
|
560 | 503 | " |
|
561 |
" Obtains a |
|
|
504 | " Obtains a HG revision number and branch name. The 'revisionVar', | |
|
562 | 505 | " 'branchVar'and 'repositoryVar' arguments, if non-empty, contain the names of variables to hold |
|
563 | 506 | " the corresponding results. |
|
564 | 507 | " |
|
565 | 508 | " Returns: string to be exec'd that sets the multiple return values. |
|
566 | 509 | |
|
567 |
function! s: |
|
|
568 |
let |
|
|
569 |
if |
|
|
510 | function! s:HGGetStatusVars(revisionVar, branchVar, repositoryVar) | |
|
511 | let hgBufferCheck=s:HGCurrentBufferCheck() | |
|
512 | if hgBufferCheck == -1 | |
|
570 | 513 | return "" |
|
571 | 514 | endif |
|
572 |
let fileName=bufname( |
|
|
573 |
let realFileName = fnamemodify(s: |
|
|
574 |
let oldCwd=s: |
|
|
515 | let fileName=bufname(hgBufferCheck) | |
|
516 | let realFileName = fnamemodify(s:HGResolveLink(fileName), ':t') | |
|
517 | let oldCwd=s:HGChangeToCurrentFileDir(fileName) | |
|
575 | 518 | try |
|
576 | if !filereadable('CVS/Root') | |
|
577 | return "" | |
|
578 | endif | |
|
579 | let cvsCommand = s:CVSGetOption("CVSCommandCVSExec", "cvs") . " status " . escape(realFileName, ' *?\') | |
|
580 | let statustext=system(cvsCommand) | |
|
519 | ""TODO | |
|
520 | "if !filereadable('HG/Root') | |
|
521 | "return "" | |
|
522 | "endif | |
|
523 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " status -mardui " . fileName | |
|
524 | let statustext=system(hgCommand) | |
|
581 | 525 | if(v:shell_error) |
|
582 | 526 | return "" |
|
583 | 527 | endif |
|
584 | let revision=substitute(statustext, '^\_.*Working revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\)\_.*$', '\1', "") | |
|
585 | ||
|
586 | " We can still be in a CVS-controlled directory without this being a CVS | |
|
587 | " file | |
|
588 | if match(revision, '^New file!$') >= 0 | |
|
528 | if match(statustext, '^[?I]') >= 0 | |
|
589 | 529 | let revision="NEW" |
|
590 | elseif match(revision, '^\d\+\.\d\+\%(\.\d\+\.\d\+\)*$') >=0 | |
|
591 | else | |
|
592 | return "" | |
|
530 | elseif match(statustext, '^[R]') >= 0 | |
|
531 | let revision="REMOVED" | |
|
532 | elseif match(statustext, '^[D]') >= 0 | |
|
533 | let revision="DELETED" | |
|
534 | elseif match(statustext, '^[A]') >= 0 | |
|
535 | let revision="ADDED" | |
|
593 | 536 | endif |
|
594 | 537 | |
|
595 | let returnExpression = "let " . a:revisionVar . "='" . revision . "'" | |
|
538 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " parents -b " | |
|
539 | let statustext=system(hgCommand) | |
|
540 | if(v:shell_error) | |
|
541 | return "" | |
|
542 | endif | |
|
543 | if exists('revision') | |
|
544 | let returnExpression = "let " . a:revisionVar . "='" . revision . "'" | |
|
545 | else | |
|
546 | let revision=substitute(statustext, '^changeset:\s*\(\d\+\):.*\_$\_.*$', '\1', "") | |
|
547 | let returnExpression = "let " . a:revisionVar . "='" . revision . "'" | |
|
548 | endif | |
|
596 | 549 | |
|
597 | if a:branchVar != "" | |
|
598 |
let branch=substitute(statustext, '^\_.* |
|
|
550 | if a:branchVar != "" && match(statustext, '^\_.*\_^branch:') >= 0 | |
|
551 | let branch=substitute(statustext, '^\_.*\_^branch:\s*\(\S\+\)\n\_.*$', '\1', "") | |
|
599 | 552 | let returnExpression=returnExpression . " | let " . a:branchVar . "='" . branch . "'" |
|
600 | 553 | endif |
|
601 | ||
|
602 | 554 | if a:repositoryVar != "" |
|
603 | let repository=substitute(statustext, '^\_.*Repository revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\|No revision control file\)\_.*$', '\1', "") | |
|
604 | let repository=substitute(repository, '^New file!\|No revision control file$', 'NEW', "") | |
|
555 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " root " | |
|
556 | let roottext=system(hgCommand) | |
|
557 | let repository=substitute(roottext,'^.*/\([^/\n\r]*\)\n\_.*$','\1','') | |
|
605 | 558 | let returnExpression=returnExpression . " | let " . a:repositoryVar . "='" . repository . "'" |
|
606 | 559 | endif |
|
607 | 560 | |
|
561 | ||
|
562 | ||
|
608 | 563 | return returnExpression |
|
609 | 564 | finally |
|
610 | 565 | execute 'cd' escape(oldCwd, ' ') |
|
611 | 566 | endtry |
|
612 | 567 | endfunction |
|
613 | 568 | |
|
614 |
" Function: s: |
|
|
615 |
" Attempts to set the b: |
|
|
569 | " Function: s:HGSetupBuffer() {{{2 | |
|
570 | " Attempts to set the b:HGBranch, b:HGRevision and b:HGRepository variables. | |
|
616 | 571 | |
|
617 |
function! s: |
|
|
618 |
if (exists("b: |
|
|
572 | function! s:HGSetupBuffer() | |
|
573 | if (exists("b:HGBufferSetup") && b:HGBufferSetup) | |
|
619 | 574 | " This buffer is already set up. |
|
620 | 575 | return |
|
621 | 576 | endif |
|
622 | 577 | |
|
623 |
if !s: |
|
|
578 | if !s:HGGetOption("HGCommandEnableBufferSetup", 0) | |
|
624 | 579 | \ || @% == "" |
|
625 |
\ || s: |
|
|
626 |
\ || exists("b: |
|
|
627 |
unlet! b: |
|
|
628 |
unlet! b: |
|
|
629 |
unlet! b: |
|
|
580 | \ || s:HGCommandEditFileRunning > 0 | |
|
581 | \ || exists("b:HGOrigBuffNR") | |
|
582 | unlet! b:HGRevision | |
|
583 | unlet! b:HGBranch | |
|
584 | unlet! b:HGRepository | |
|
630 | 585 | return |
|
631 | 586 | endif |
|
632 | 587 | |
@@ -638,47 +593,48 b' function! s:CVSSetupBuffer()' | |||
|
638 | 593 | let branch="" |
|
639 | 594 | let repository="" |
|
640 | 595 | |
|
641 |
exec s: |
|
|
596 | exec s:HGGetStatusVars('revision', 'branch', 'repository') | |
|
597 | "echomsg "DBG ".revision."#".branch."#".repository | |
|
642 | 598 | if revision != "" |
|
643 |
let b: |
|
|
599 | let b:HGRevision=revision | |
|
644 | 600 | else |
|
645 |
unlet! b: |
|
|
601 | unlet! b:HGRevision | |
|
646 | 602 | endif |
|
647 | 603 | if branch != "" |
|
648 |
let b: |
|
|
604 | let b:HGBranch=branch | |
|
649 | 605 | else |
|
650 |
unlet! b: |
|
|
606 | unlet! b:HGBranch | |
|
651 | 607 | endif |
|
652 | 608 | if repository != "" |
|
653 |
let b: |
|
|
609 | let b:HGRepository=repository | |
|
654 | 610 | else |
|
655 |
unlet! b: |
|
|
611 | unlet! b:HGRepository | |
|
656 | 612 | endif |
|
657 |
silent do |
|
|
658 |
let b: |
|
|
613 | silent do HGCommand User HGBufferSetup | |
|
614 | let b:HGBufferSetup=1 | |
|
659 | 615 | endfunction |
|
660 | 616 | |
|
661 |
" Function: s: |
|
|
662 |
" Resets the buffer setup state of the original buffer for a given |
|
|
663 |
" Returns: The |
|
|
617 | " Function: s:HGMarkOrigBufferForSetup(hgbuffer) {{{2 | |
|
618 | " Resets the buffer setup state of the original buffer for a given HG buffer. | |
|
619 | " Returns: The HG buffer number in a passthrough mode. | |
|
664 | 620 | |
|
665 |
function! s: |
|
|
621 | function! s:HGMarkOrigBufferForSetup(hgBuffer) | |
|
666 | 622 | checktime |
|
667 |
if a: |
|
|
668 |
let origBuffer = s: |
|
|
623 | if a:hgBuffer != -1 | |
|
624 | let origBuffer = s:HGBufferCheck(a:hgBuffer) | |
|
669 | 625 | "This should never not work, but I'm paranoid |
|
670 |
if origBuffer != a: |
|
|
671 |
call setbufvar(origBuffer, " |
|
|
626 | if origBuffer != a:hgBuffer | |
|
627 | call setbufvar(origBuffer, "HGBufferSetup", 0) | |
|
672 | 628 | endif |
|
673 | 629 | endif |
|
674 |
return a: |
|
|
630 | return a:hgBuffer | |
|
675 | 631 | endfunction |
|
676 | 632 | |
|
677 |
" Function: s: |
|
|
678 |
" Provides a temporary override for the given |
|
|
633 | " Function: s:HGOverrideOption(option, [value]) {{{2 | |
|
634 | " Provides a temporary override for the given HG option. If no value is | |
|
679 | 635 | " passed, the override is disabled. |
|
680 | 636 | |
|
681 |
function! s: |
|
|
637 | function! s:HGOverrideOption(option, ...) | |
|
682 | 638 | if a:0 == 0 |
|
683 | 639 | unlet! s:{a:option}Override |
|
684 | 640 | else |
@@ -686,14 +642,14 b' function! s:CVSOverrideOption(option, ..' | |||
|
686 | 642 | endif |
|
687 | 643 | endfunction |
|
688 | 644 | |
|
689 |
" Function: s: |
|
|
690 |
" Clears all current |
|
|
645 | " Function: s:HGWipeoutCommandBuffers() {{{2 | |
|
646 | " Clears all current HG buffers of the specified type for a given source. | |
|
691 | 647 | |
|
692 |
function! s: |
|
|
648 | function! s:HGWipeoutCommandBuffers(originalBuffer, hgCommand) | |
|
693 | 649 | let buffer = 1 |
|
694 | 650 | while buffer <= bufnr('$') |
|
695 |
if getbufvar(buffer, ' |
|
|
696 |
if getbufvar(buffer, ' |
|
|
651 | if getbufvar(buffer, 'HGOrigBuffNR') == a:originalBuffer | |
|
652 | if getbufvar(buffer, 'HGCommand') == a:hgCommand | |
|
697 | 653 | execute 'bw' buffer |
|
698 | 654 | endif |
|
699 | 655 | endif |
@@ -703,104 +659,92 b' endfunction' | |||
|
703 | 659 | |
|
704 | 660 | " Section: Public functions {{{1 |
|
705 | 661 | |
|
706 |
" Function: |
|
|
707 |
" Global function for retrieving the current buffer's |
|
|
662 | " Function: HGGetRevision() {{{2 | |
|
663 | " Global function for retrieving the current buffer's HG revision number. | |
|
708 | 664 | " Returns: Revision number or an empty string if an error occurs. |
|
709 | 665 | |
|
710 |
function! |
|
|
666 | function! HGGetRevision() | |
|
711 | 667 | let revision="" |
|
712 |
exec s: |
|
|
668 | exec s:HGGetStatusVars('revision', '', '') | |
|
713 | 669 | return revision |
|
714 | 670 | endfunction |
|
715 | 671 | |
|
716 |
" Function: |
|
|
672 | " Function: HGDisableBufferSetup() {{{2 | |
|
717 | 673 | " Global function for deactivating the buffer autovariables. |
|
718 | 674 | |
|
719 |
function! |
|
|
720 |
let g: |
|
|
721 |
silent! augroup! |
|
|
675 | function! HGDisableBufferSetup() | |
|
676 | let g:HGCommandEnableBufferSetup=0 | |
|
677 | silent! augroup! HGCommandPlugin | |
|
722 | 678 | endfunction |
|
723 | 679 | |
|
724 |
" Function: |
|
|
680 | " Function: HGEnableBufferSetup() {{{2 | |
|
725 | 681 | " Global function for activating the buffer autovariables. |
|
726 | 682 | |
|
727 |
function! |
|
|
728 |
let g: |
|
|
729 |
augroup |
|
|
683 | function! HGEnableBufferSetup() | |
|
684 | let g:HGCommandEnableBufferSetup=1 | |
|
685 | augroup HGCommandPlugin | |
|
730 | 686 | au! |
|
731 |
au BufEnter * call s: |
|
|
687 | au BufEnter * call s:HGSetupBuffer() | |
|
732 | 688 | augroup END |
|
733 | 689 | |
|
734 | 690 | " Only auto-load if the plugin is fully loaded. This gives other plugins a |
|
735 | 691 | " chance to run. |
|
736 |
if g:loaded_ |
|
|
737 |
call s: |
|
|
692 | if g:loaded_hgcommand == 2 | |
|
693 | call s:HGSetupBuffer() | |
|
738 | 694 | endif |
|
739 | 695 | endfunction |
|
740 | 696 | |
|
741 |
" Function: |
|
|
742 |
" Default (sample) status line entry for |
|
|
743 |
" |
|
|
697 | " Function: HGGetStatusLine() {{{2 | |
|
698 | " Default (sample) status line entry for HG files. This is only useful if | |
|
699 | " HG-managed buffer mode is on (see the HGCommandEnableBufferSetup variable | |
|
744 | 700 | " for how to do this). |
|
745 | 701 | |
|
746 |
function! |
|
|
747 |
if exists('b: |
|
|
702 | function! HGGetStatusLine() | |
|
703 | if exists('b:HGSourceFile') | |
|
748 | 704 | " This is a result buffer |
|
749 |
let value='[' . b: |
|
|
750 |
if exists('b: |
|
|
751 |
let value=value . ' ' . b: |
|
|
705 | let value='[' . b:HGCommand . ' ' . b:HGSourceFile | |
|
706 | if exists('b:HGStatusText') | |
|
707 | let value=value . ' ' . b:HGStatusText | |
|
752 | 708 | endif |
|
753 | 709 | let value = value . ']' |
|
754 | 710 | return value |
|
755 | 711 | endif |
|
756 | 712 | |
|
757 |
if exists('b: |
|
|
758 |
\ && b: |
|
|
759 |
\ && exists('b: |
|
|
760 |
\ && b: |
|
|
761 |
\ && exists('b: |
|
|
762 |
\ && b: |
|
|
763 |
\ && exists('g: |
|
|
764 |
\ && g: |
|
|
765 | if b:CVSRevision == b:CVSRepository | |
|
766 | return '[CVS ' . b:CVSBranch . '/' . b:CVSRevision . ']' | |
|
767 | else | |
|
768 | return '[CVS ' . b:CVSBranch . '/' . b:CVSRevision . '/' . b:CVSRepository . ']' | |
|
769 | endif | |
|
713 | if exists('b:HGRevision') | |
|
714 | \ && b:HGRevision != '' | |
|
715 | \ && exists('b:HGBranch') | |
|
716 | \ && b:HGBranch != '' | |
|
717 | \ && exists('b:HGRepository') | |
|
718 | \ && b:HGRepository != '' | |
|
719 | \ && exists('g:HGCommandEnableBufferSetup') | |
|
720 | \ && g:HGCommandEnableBufferSetup | |
|
721 | return '[HG ' . b:HGRepository . '/' . b:HGBranch .'/' . b:HGRevision . ']' | |
|
770 | 722 | else |
|
771 | 723 | return '' |
|
772 | 724 | endif |
|
773 | 725 | endfunction |
|
774 | 726 | |
|
775 |
" Section: |
|
|
727 | " Section: HG command functions {{{1 | |
|
776 | 728 | |
|
777 |
" Function: s: |
|
|
778 |
function! s: |
|
|
779 |
return s: |
|
|
729 | " Function: s:HGAdd() {{{2 | |
|
730 | function! s:HGAdd() | |
|
731 | return s:HGMarkOrigBufferForSetup(s:HGDoCommand('add', 'hgadd', '')) | |
|
780 | 732 | endfunction |
|
781 | 733 | |
|
782 |
" Function: s: |
|
|
783 |
function! s: |
|
|
734 | " Function: s:HGAnnotate(...) {{{2 | |
|
735 | function! s:HGAnnotate(...) | |
|
784 | 736 | if a:0 == 0 |
|
785 |
if &filetype == " |
|
|
786 |
" This is a |
|
|
737 | if &filetype == "HGAnnotate" | |
|
738 | " This is a HGAnnotate buffer. Perform annotation of the version | |
|
787 | 739 | " indicated by the current line. |
|
788 |
let revision = substitute(getline("."),'\(^[0-9 |
|
|
789 | let revmin = substitute(revision,'^[0-9.]*\.\([0-9]\+\)','\1','') | |
|
790 | let revmaj = substitute(revision,'^\([0-9.]*\)\.[0-9]\+','\1','') | |
|
791 | if s:CVSGetOption('CVSCommandAnnotateParent', 0) != 0 | |
|
792 | let revmin = revmin - 1 | |
|
793 | endif | |
|
794 | if revmin == 0 | |
|
795 | " Jump to ancestor branch | |
|
796 | let revision = substitute(revmaj,'^\([0-9.]*\)\.[0-9]\+','\1','') | |
|
797 | else | |
|
798 | let revision=revmaj . "." . revmin | |
|
740 | let revision = substitute(getline("."),'\(^[0-9]*\):.*','\1','') | |
|
741 | if s:HGGetOption('HGCommandAnnotateParent', 0) != 0 && revision > 0 | |
|
742 | let revision = revision - 1 | |
|
799 | 743 | endif |
|
800 | 744 | else |
|
801 |
let revision= |
|
|
745 | let revision=HGGetRevision() | |
|
802 | 746 | if revision == "" |
|
803 |
echoerr "Unable to obtain |
|
|
747 | echoerr "Unable to obtain HG version information." | |
|
804 | 748 | return -1 |
|
805 | 749 | endif |
|
806 | 750 | endif |
@@ -813,27 +757,26 b' function! s:CVSAnnotate(...)' | |||
|
813 | 757 | return -1 |
|
814 | 758 | endif |
|
815 | 759 | |
|
816 |
let resultBuffer=s: |
|
|
760 | let resultBuffer=s:HGDoCommand('annotate -ndu -r ' . revision, 'hgannotate', revision) | |
|
761 | echomsg "DBG: ".resultBuffer | |
|
817 | 762 | if resultBuffer != -1 |
|
818 |
set filetype= |
|
|
819 | " Remove header lines from standard error | |
|
820 | silent v/^\d\+\%(\.\d\+\)\+/d | |
|
763 | set filetype=HGAnnotate | |
|
821 | 764 | endif |
|
822 | 765 | |
|
823 | 766 | return resultBuffer |
|
824 | 767 | endfunction |
|
825 | 768 | |
|
826 |
" Function: s: |
|
|
827 |
function! s: |
|
|
769 | " Function: s:HGCommit() {{{2 | |
|
770 | function! s:HGCommit(...) | |
|
828 | 771 | " Handle the commit message being specified. If a message is supplied, it |
|
829 | 772 | " is used; if bang is supplied, an empty message is used; otherwise, the |
|
830 | 773 | " user is provided a buffer from which to edit the commit message. |
|
831 | 774 | if a:2 != "" || a:1 == "!" |
|
832 |
return s: |
|
|
775 | return s:HGMarkOrigBufferForSetup(s:HGDoCommand('commit -m "' . a:2 . '"', 'hgcommit', '')) | |
|
833 | 776 | endif |
|
834 | 777 | |
|
835 |
let |
|
|
836 |
if |
|
|
778 | let hgBufferCheck=s:HGCurrentBufferCheck() | |
|
779 | if hgBufferCheck == -1 | |
|
837 | 780 | echo "Original buffer no longer exists, aborting." |
|
838 | 781 | return -1 |
|
839 | 782 | endif |
@@ -847,8 +790,8 b' function! s:CVSCommit(...)' | |||
|
847 | 790 | |
|
848 | 791 | let messageFileName = tempname() |
|
849 | 792 | |
|
850 |
let fileName=bufname( |
|
|
851 |
let realFilePath=s: |
|
|
793 | let fileName=bufname(hgBufferCheck) | |
|
794 | let realFilePath=s:HGResolveLink(fileName) | |
|
852 | 795 | let newCwd=fnamemodify(realFilePath, ':h') |
|
853 | 796 | if strlen(newCwd) == 0 |
|
854 | 797 | " Account for autochdir being in effect, which will make this blank, but |
@@ -858,7 +801,7 b' function! s:CVSCommit(...)' | |||
|
858 | 801 | |
|
859 | 802 | let realFileName=fnamemodify(realFilePath, ':t') |
|
860 | 803 | |
|
861 |
if s: |
|
|
804 | if s:HGEditFile(messageFileName, hgBufferCheck) == -1 | |
|
862 | 805 | return |
|
863 | 806 | endif |
|
864 | 807 | |
@@ -866,49 +809,49 b' function! s:CVSCommit(...)' | |||
|
866 | 809 | let autoPattern = '\c' . messageFileName |
|
867 | 810 | |
|
868 | 811 | " Ensure existance of group |
|
869 |
augroup |
|
|
812 | augroup HGCommit | |
|
870 | 813 | augroup END |
|
871 | 814 | |
|
872 |
execute 'au |
|
|
873 |
execute 'au |
|
|
815 | execute 'au HGCommit BufDelete' autoPattern 'call delete("' . messageFileName . '")' | |
|
816 | execute 'au HGCommit BufDelete' autoPattern 'au! HGCommit * ' autoPattern | |
|
874 | 817 | |
|
875 | 818 | " Create a commit mapping. The mapping must clear all autocommands in case |
|
876 |
" it is invoked when |
|
|
819 | " it is invoked when HGCommandCommitOnWrite is active, as well as to not | |
|
877 | 820 | " invoke the buffer deletion autocommand. |
|
878 | 821 | |
|
879 |
execute 'nnoremap <silent> <buffer> <Plug> |
|
|
880 |
\ ':au! |
|
|
881 |
\ ':g/^ |
|
|
822 | execute 'nnoremap <silent> <buffer> <Plug>HGCommit '. | |
|
823 | \ ':au! HGCommit * ' . autoPattern . '<CR>'. | |
|
824 | \ ':g/^HG:/d<CR>'. | |
|
882 | 825 | \ ':update<CR>'. |
|
883 |
\ ':call <SID> |
|
|
826 | \ ':call <SID>HGFinishCommit("' . messageFileName . '",' . | |
|
884 | 827 | \ '"' . newCwd . '",' . |
|
885 | 828 | \ '"' . realFileName . '",' . |
|
886 |
\ |
|
|
829 | \ hgBufferCheck . ')<CR>' | |
|
887 | 830 | |
|
888 |
silent 0put =' |
|
|
889 |
silent put =\" |
|
|
890 |
silent put =' |
|
|
831 | silent 0put ='HG: ----------------------------------------------------------------------' | |
|
832 | silent put =\"HG: Enter Log. Lines beginning with `HG:' are removed automatically\" | |
|
833 | silent put ='HG: Type <leader>cc (or your own <Plug>HGCommit mapping)' | |
|
891 | 834 | |
|
892 |
if s: |
|
|
893 |
execute 'au |
|
|
894 |
execute 'au |
|
|
895 |
silent put =' |
|
|
835 | if s:HGGetOption('HGCommandCommitOnWrite', 1) == 1 | |
|
836 | execute 'au HGCommit BufWritePre' autoPattern 'g/^HG:/d' | |
|
837 | execute 'au HGCommit BufWritePost' autoPattern 'call s:HGFinishCommit("' . messageFileName . '", "' . newCwd . '", "' . realFileName . '", ' . hgBufferCheck . ') | au! * ' autoPattern | |
|
838 | silent put ='HG: or write this buffer' | |
|
896 | 839 | endif |
|
897 | 840 | |
|
898 |
silent put =' |
|
|
899 |
silent put =' |
|
|
841 | silent put ='HG: to finish this commit operation' | |
|
842 | silent put ='HG: ----------------------------------------------------------------------' | |
|
900 | 843 | $ |
|
901 |
let b: |
|
|
902 |
let b: |
|
|
903 |
set filetype= |
|
|
844 | let b:HGSourceFile=fileName | |
|
845 | let b:HGCommand='HGCommit' | |
|
846 | set filetype=hg | |
|
904 | 847 | finally |
|
905 | 848 | let &shellslash = shellSlashBak |
|
906 | 849 | endtry |
|
907 | 850 | |
|
908 | 851 | endfunction |
|
909 | 852 | |
|
910 |
" Function: s: |
|
|
911 |
function! s: |
|
|
853 | " Function: s:HGDiff(...) {{{2 | |
|
854 | function! s:HGDiff(...) | |
|
912 | 855 | if a:0 == 1 |
|
913 | 856 | let revOptions = '-r' . a:1 |
|
914 | 857 | let caption = a:1 . ' -> current' |
@@ -920,34 +863,25 b' function! s:CVSDiff(...)' | |||
|
920 | 863 | let caption = '' |
|
921 | 864 | endif |
|
922 | 865 | |
|
923 |
let |
|
|
866 | let hgdiffopt=s:HGGetOption('HGCommandDiffOpt', 'w') | |
|
924 | 867 | |
|
925 |
if |
|
|
868 | if hgdiffopt == "" | |
|
926 | 869 | let diffoptionstring="" |
|
927 | 870 | else |
|
928 |
let diffoptionstring=" -" . |
|
|
871 | let diffoptionstring=" -" . hgdiffopt . " " | |
|
929 | 872 | endif |
|
930 | 873 | |
|
931 |
let resultBuffer = s: |
|
|
874 | let resultBuffer = s:HGDoCommand('diff ' . diffoptionstring . revOptions , 'hgdiff', caption) | |
|
932 | 875 | if resultBuffer != -1 |
|
933 | 876 | set filetype=diff |
|
934 | 877 | endif |
|
935 | 878 | return resultBuffer |
|
936 | 879 | endfunction |
|
937 | 880 | |
|
938 | " Function: s:CVSEdit() {{{2 | |
|
939 | function! s:CVSEdit() | |
|
940 | return s:CVSDoCommand('edit', 'cvsedit', '') | |
|
941 | endfunction | |
|
942 | 881 |
|
|
943 |
" Function: s: |
|
|
944 |
function! s: |
|
|
945 | return s:CVSDoCommand('editors', 'cvseditors', '') | |
|
946 | endfunction | |
|
947 | ||
|
948 | " Function: s:CVSGotoOriginal(["!]) {{{2 | |
|
949 | function! s:CVSGotoOriginal(...) | |
|
950 | let origBuffNR = s:CVSCurrentBufferCheck() | |
|
882 | " Function: s:HGGotoOriginal(["!]) {{{2 | |
|
883 | function! s:HGGotoOriginal(...) | |
|
884 | let origBuffNR = s:HGCurrentBufferCheck() | |
|
951 | 885 | if origBuffNR > 0 |
|
952 | 886 | let origWinNR = bufwinnr(origBuffNR) |
|
953 | 887 | if origWinNR == -1 |
@@ -960,7 +894,7 b' function! s:CVSGotoOriginal(...)' | |||
|
960 | 894 | let buffnr = 1 |
|
961 | 895 | let buffmaxnr = bufnr("$") |
|
962 | 896 | while buffnr <= buffmaxnr |
|
963 |
if getbufvar(buffnr, " |
|
|
897 | if getbufvar(buffnr, "HGOrigBuffNR") == origBuffNR | |
|
964 | 898 | execute "bw" buffnr |
|
965 | 899 | endif |
|
966 | 900 | let buffnr = buffnr + 1 |
@@ -970,26 +904,26 b' function! s:CVSGotoOriginal(...)' | |||
|
970 | 904 | endif |
|
971 | 905 | endfunction |
|
972 | 906 | |
|
973 |
" Function: s: |
|
|
974 |
function! s: |
|
|
907 | " Function: s:HGFinishCommit(messageFile, targetDir, targetFile) {{{2 | |
|
908 | function! s:HGFinishCommit(messageFile, targetDir, targetFile, origBuffNR) | |
|
975 | 909 | if filereadable(a:messageFile) |
|
976 | 910 | let oldCwd=getcwd() |
|
977 | 911 | if strlen(a:targetDir) > 0 |
|
978 | 912 | execute 'cd' escape(a:targetDir, ' ') |
|
979 | 913 | endif |
|
980 |
let resultBuffer=s: |
|
|
914 | let resultBuffer=s:HGCreateCommandBuffer('commit -F "' . a:messageFile . '" "'. a:targetFile . '"', 'hgcommit', '', a:origBuffNR) | |
|
981 | 915 | execute 'cd' escape(oldCwd, ' ') |
|
982 | 916 | execute 'bw' escape(a:messageFile, ' *?\') |
|
983 | 917 | silent execute 'call delete("' . a:messageFile . '")' |
|
984 |
return s: |
|
|
918 | return s:HGMarkOrigBufferForSetup(resultBuffer) | |
|
985 | 919 | else |
|
986 | 920 | echoerr "Can't read message file; no commit is possible." |
|
987 | 921 | return -1 |
|
988 | 922 | endif |
|
989 | 923 | endfunction |
|
990 | 924 | |
|
991 |
" Function: s: |
|
|
992 |
function! s: |
|
|
925 | " Function: s:HGLog() {{{2 | |
|
926 | function! s:HGLog(...) | |
|
993 | 927 | if a:0 == 0 |
|
994 | 928 | let versionOption = "" |
|
995 | 929 | let caption = '' |
@@ -998,23 +932,23 b' function! s:CVSLog(...)' | |||
|
998 | 932 | let caption = a:1 |
|
999 | 933 | endif |
|
1000 | 934 | |
|
1001 |
let resultBuffer=s: |
|
|
935 | let resultBuffer=s:HGDoCommand('log' . versionOption, 'hglog', caption) | |
|
1002 | 936 | if resultBuffer != "" |
|
1003 | 937 | set filetype=rcslog |
|
1004 | 938 | endif |
|
1005 | 939 | return resultBuffer |
|
1006 | 940 | endfunction |
|
1007 | 941 | |
|
1008 |
" Function: s: |
|
|
1009 |
function! s: |
|
|
1010 |
return s: |
|
|
942 | " Function: s:HGRevert() {{{2 | |
|
943 | function! s:HGRevert() | |
|
944 | return s:HGMarkOrigBufferForSetup(s:HGDoCommand('revert', 'hgrevert', '')) | |
|
1011 | 945 | endfunction |
|
1012 | 946 | |
|
1013 |
" Function: s: |
|
|
1014 |
function! s: |
|
|
947 | " Function: s:HGReview(...) {{{2 | |
|
948 | function! s:HGReview(...) | |
|
1015 | 949 | if a:0 == 0 |
|
1016 | 950 | let versiontag="" |
|
1017 |
if s: |
|
|
951 | if s:HGGetOption('HGCommandInteractive', 0) | |
|
1018 | 952 | let versiontag=input('Revision: ') |
|
1019 | 953 | endif |
|
1020 | 954 | if versiontag == "" |
@@ -1028,69 +962,65 b' function! s:CVSReview(...)' | |||
|
1028 | 962 | let versionOption=" -r " . versiontag . " " |
|
1029 | 963 | endif |
|
1030 | 964 | |
|
1031 |
let resultBuffer = s: |
|
|
965 | let resultBuffer = s:HGDoCommand('cat' . versionOption, 'hgreview', versiontag) | |
|
1032 | 966 | if resultBuffer > 0 |
|
1033 |
let &filetype=getbufvar(b: |
|
|
967 | let &filetype=getbufvar(b:HGOrigBuffNR, '&filetype') | |
|
1034 | 968 | endif |
|
1035 | 969 | |
|
1036 | 970 | return resultBuffer |
|
1037 | 971 | endfunction |
|
1038 | 972 | |
|
1039 |
" Function: s: |
|
|
1040 |
function! s: |
|
|
1041 |
return s: |
|
|
1042 | endfunction | |
|
1043 | ||
|
1044 | " Function: s:CVSUnedit() {{{2 | |
|
1045 | function! s:CVSUnedit() | |
|
1046 | return s:CVSDoCommand('unedit', 'cvsunedit', '') | |
|
973 | " Function: s:HGStatus() {{{2 | |
|
974 | function! s:HGStatus() | |
|
975 | return s:HGDoCommand('status', 'hgstatus', '') | |
|
1047 | 976 | endfunction |
|
1048 | 977 | |
|
1049 | " Function: s:CVSUpdate() {{{2 | |
|
1050 |
|
|
|
1051 | return s:CVSMarkOrigBufferForSetup(s:CVSDoCommand('update', 'update', '')) | |
|
978 | ||
|
979 | " Function: s:HGUpdate() {{{2 | |
|
980 | function! s:HGUpdate() | |
|
981 | return s:HGMarkOrigBufferForSetup(s:HGDoCommand('update', 'update', '')) | |
|
1052 | 982 | endfunction |
|
1053 | 983 | |
|
1054 |
" Function: s: |
|
|
1055 |
function! s: |
|
|
1056 |
let originalBuffer = s: |
|
|
1057 |
let s: |
|
|
984 | " Function: s:HGVimDiff(...) {{{2 | |
|
985 | function! s:HGVimDiff(...) | |
|
986 | let originalBuffer = s:HGCurrentBufferCheck() | |
|
987 | let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning + 1 | |
|
1058 | 988 | try |
|
1059 | 989 | " If there's already a VimDiff'ed window, restore it. |
|
1060 |
" There may only be one |
|
|
990 | " There may only be one HGVimDiff original window at a time. | |
|
1061 | 991 | |
|
1062 | 992 | if exists("s:vimDiffSourceBuffer") && s:vimDiffSourceBuffer != originalBuffer |
|
1063 | 993 | " Clear the existing vimdiff setup by removing the result buffers. |
|
1064 |
call s: |
|
|
994 | call s:HGWipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff') | |
|
1065 | 995 | endif |
|
1066 | 996 | |
|
1067 | 997 | " Split and diff |
|
1068 | 998 | if(a:0 == 2) |
|
1069 | 999 | " Reset the vimdiff system, as 2 explicit versions were provided. |
|
1070 | 1000 | if exists('s:vimDiffSourceBuffer') |
|
1071 |
call s: |
|
|
1001 | call s:HGWipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff') | |
|
1072 | 1002 | endif |
|
1073 |
let resultBuffer = s: |
|
|
1003 | let resultBuffer = s:HGReview(a:1) | |
|
1074 | 1004 | if resultBuffer < 0 |
|
1075 |
echomsg "Can't open |
|
|
1005 | echomsg "Can't open HG revision " . a:1 | |
|
1076 | 1006 | return resultBuffer |
|
1077 | 1007 | endif |
|
1078 |
let b: |
|
|
1008 | let b:HGCommand = 'vimdiff' | |
|
1079 | 1009 | diffthis |
|
1080 | 1010 | let s:vimDiffBufferCount = 1 |
|
1081 | 1011 | let s:vimDiffScratchList = '{'. resultBuffer . '}' |
|
1082 | 1012 | " If no split method is defined, cheat, and set it to vertical. |
|
1083 | 1013 | try |
|
1084 |
call s: |
|
|
1085 |
let resultBuffer=s: |
|
|
1014 | call s:HGOverrideOption('HGCommandSplit', s:HGGetOption('HGCommandDiffSplit', s:HGGetOption('HGCommandSplit', 'vertical'))) | |
|
1015 | let resultBuffer=s:HGReview(a:2) | |
|
1086 | 1016 | finally |
|
1087 |
call s: |
|
|
1017 | call s:HGOverrideOption('HGCommandSplit') | |
|
1088 | 1018 | endtry |
|
1089 | 1019 | if resultBuffer < 0 |
|
1090 |
echomsg "Can't open |
|
|
1020 | echomsg "Can't open HG revision " . a:1 | |
|
1091 | 1021 | return resultBuffer |
|
1092 | 1022 | endif |
|
1093 |
let b: |
|
|
1023 | let b:HGCommand = 'vimdiff' | |
|
1094 | 1024 | diffthis |
|
1095 | 1025 | let s:vimDiffBufferCount = 2 |
|
1096 | 1026 | let s:vimDiffScratchList = s:vimDiffScratchList . '{'. resultBuffer . '}' |
@@ -1098,22 +1028,22 b' function! s:CVSVimDiff(...)' | |||
|
1098 | 1028 | " Add new buffer |
|
1099 | 1029 | try |
|
1100 | 1030 | " Force splitting behavior, otherwise why use vimdiff? |
|
1101 |
call s: |
|
|
1102 |
call s: |
|
|
1031 | call s:HGOverrideOption("HGCommandEdit", "split") | |
|
1032 | call s:HGOverrideOption("HGCommandSplit", s:HGGetOption('HGCommandDiffSplit', s:HGGetOption('HGCommandSplit', 'vertical'))) | |
|
1103 | 1033 | if(a:0 == 0) |
|
1104 |
let resultBuffer=s: |
|
|
1034 | let resultBuffer=s:HGReview() | |
|
1105 | 1035 | else |
|
1106 |
let resultBuffer=s: |
|
|
1036 | let resultBuffer=s:HGReview(a:1) | |
|
1107 | 1037 | endif |
|
1108 | 1038 | finally |
|
1109 |
call s: |
|
|
1110 |
call s: |
|
|
1039 | call s:HGOverrideOption("HGCommandEdit") | |
|
1040 | call s:HGOverrideOption("HGCommandSplit") | |
|
1111 | 1041 | endtry |
|
1112 | 1042 | if resultBuffer < 0 |
|
1113 |
echomsg "Can't open current |
|
|
1043 | echomsg "Can't open current HG revision" | |
|
1114 | 1044 | return resultBuffer |
|
1115 | 1045 | endif |
|
1116 |
let b: |
|
|
1046 | let b:HGCommand = 'vimdiff' | |
|
1117 | 1047 | diffthis |
|
1118 | 1048 | |
|
1119 | 1049 | if !exists('s:vimDiffBufferCount') |
@@ -1121,7 +1051,7 b' function! s:CVSVimDiff(...)' | |||
|
1121 | 1051 | let s:vimDiffBufferCount = 2 |
|
1122 | 1052 | let s:vimDiffScratchList = '{' . resultBuffer . '}' |
|
1123 | 1053 | |
|
1124 |
" This could have been invoked on a |
|
|
1054 | " This could have been invoked on a HG result buffer, not the | |
|
1125 | 1055 | " original buffer. |
|
1126 | 1056 | wincmd W |
|
1127 | 1057 | execute 'buffer' originalBuffer |
@@ -1151,168 +1081,115 b' function! s:CVSVimDiff(...)' | |||
|
1151 | 1081 | let saveModeline = getbufvar(currentBuffer, '&modeline') |
|
1152 | 1082 | try |
|
1153 | 1083 | call setbufvar(currentBuffer, '&modeline', 0) |
|
1154 |
silent do |
|
|
1084 | silent do HGCommand User HGVimDiffFinish | |
|
1155 | 1085 | finally |
|
1156 | 1086 | call setbufvar(currentBuffer, '&modeline', saveModeline) |
|
1157 | 1087 | endtry |
|
1158 | 1088 | return resultBuffer |
|
1159 | 1089 | finally |
|
1160 |
let s: |
|
|
1090 | let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning - 1 | |
|
1161 | 1091 | endtry |
|
1162 | 1092 | endfunction |
|
1163 | 1093 | |
|
1164 | " Function: s:CVSWatch(onoff) {{{2 | |
|
1165 | function! s:CVSWatch(onoff) | |
|
1166 | if a:onoff !~ '^\c\%(on\|off\|add\|remove\)$' | |
|
1167 | echoerr "Argument to CVSWatch must be one of [on|off|add|remove]" | |
|
1168 | return -1 | |
|
1169 | end | |
|
1170 | return s:CVSDoCommand('watch ' . tolower(a:onoff), 'cvswatch', '') | |
|
1171 | endfunction | |
|
1172 | ||
|
1173 | " Function: s:CVSWatchers() {{{2 | |
|
1174 | function! s:CVSWatchers() | |
|
1175 | return s:CVSDoCommand('watchers', 'cvswatchers', '') | |
|
1176 | endfunction | |
|
1177 | ||
|
1178 | 1094 | " Section: Command definitions {{{1 |
|
1179 | 1095 | " Section: Primary commands {{{2 |
|
1180 |
com! |
|
|
1181 |
com! -nargs=? |
|
|
1182 |
com! -bang -nargs=? |
|
|
1183 |
com! -nargs=* |
|
|
1184 | com! CVSEdit call s:CVSEdit() | |
|
1185 | com! CVSEditors call s:CVSEditors() | |
|
1186 | com! -bang CVSGotoOriginal call s:CVSGotoOriginal(<q-bang>) | |
|
1187 |
com! -nargs=? |
|
|
1188 | com! CVSRevert call s:CVSRevert() | |
|
1189 | com! -nargs=? CVSReview call s:CVSReview(<f-args>) | |
|
1190 | com! CVSStatus call s:CVSStatus() | |
|
1191 | com! CVSUnedit call s:CVSUnedit() | |
|
1192 | com! CVSUpdate call s:CVSUpdate() | |
|
1193 | com! -nargs=* CVSVimDiff call s:CVSVimDiff(<f-args>) | |
|
1194 | com! -nargs=1 CVSWatch call s:CVSWatch(<f-args>) | |
|
1195 | com! CVSWatchAdd call s:CVSWatch('add') | |
|
1196 | com! CVSWatchOn call s:CVSWatch('on') | |
|
1197 | com! CVSWatchOff call s:CVSWatch('off') | |
|
1198 | com! CVSWatchRemove call s:CVSWatch('remove') | |
|
1199 | com! CVSWatchers call s:CVSWatchers() | |
|
1096 | com! HGAdd call s:HGAdd() | |
|
1097 | com! -nargs=? HGAnnotate call s:HGAnnotate(<f-args>) | |
|
1098 | com! -bang -nargs=? HGCommit call s:HGCommit(<q-bang>, <q-args>) | |
|
1099 | com! -nargs=* HGDiff call s:HGDiff(<f-args>) | |
|
1100 | com! -bang HGGotoOriginal call s:HGGotoOriginal(<q-bang>) | |
|
1101 | com! -nargs=? HGLog call s:HGLog(<f-args>) | |
|
1102 | com! HGRevert call s:HGRevert() | |
|
1103 | com! -nargs=? HGReview call s:HGReview(<f-args>) | |
|
1104 | com! HGStatus call s:HGStatus() | |
|
1105 | com! HGUpdate call s:HGUpdate() | |
|
1106 | com! -nargs=* HGVimDiff call s:HGVimDiff(<f-args>) | |
|
1200 | 1107 | |
|
1201 |
" Section: |
|
|
1202 |
com! |
|
|
1203 |
com! |
|
|
1108 | " Section: HG buffer management commands {{{2 | |
|
1109 | com! HGDisableBufferSetup call HGDisableBufferSetup() | |
|
1110 | com! HGEnableBufferSetup call HGEnableBufferSetup() | |
|
1204 | 1111 | |
|
1205 |
" Allow reloading |
|
|
1206 |
com! |
|
|
1112 | " Allow reloading hgcommand.vim | |
|
1113 | com! HGReload unlet! loaded_hgcommand | runtime plugin/hgcommand.vim | |
|
1207 | 1114 | |
|
1208 | 1115 | " Section: Plugin command mappings {{{1 |
|
1209 |
nnoremap <silent> <Plug> |
|
|
1210 |
nnoremap <silent> <Plug> |
|
|
1211 |
nnoremap <silent> <Plug> |
|
|
1212 |
nnoremap <silent> <Plug> |
|
|
1213 |
nnoremap <silent> <Plug> |
|
|
1214 |
nnoremap <silent> <Plug> |
|
|
1215 |
nnoremap <silent> <Plug> |
|
|
1216 |
nnoremap <silent> <Plug> |
|
|
1217 |
nnoremap <silent> <Plug> |
|
|
1218 |
nnoremap <silent> <Plug> |
|
|
1219 |
nnoremap <silent> <Plug> |
|
|
1220 |
nnoremap <silent> <Plug> |
|
|
1221 |
nnoremap <silent> <Plug> |
|
|
1222 |
nnoremap <silent> <Plug> |
|
|
1223 |
nnoremap <silent> <Plug> |
|
|
1224 |
nnoremap <silent> <Plug> |
|
|
1225 |
nnoremap <silent> <Plug> |
|
|
1226 | nnoremap <silent> <Plug>CVSWatchOn :CVSWatchOn<CR> | |
|
1227 | nnoremap <silent> <Plug>CVSWatchOff :CVSWatchOff<CR> | |
|
1228 | nnoremap <silent> <Plug>CVSWatchRemove :CVSWatchRemove<CR> | |
|
1116 | nnoremap <silent> <Plug>HGAdd :HGAdd<CR> | |
|
1117 | nnoremap <silent> <Plug>HGAnnotate :HGAnnotate<CR> | |
|
1118 | nnoremap <silent> <Plug>HGCommit :HGCommit<CR> | |
|
1119 | nnoremap <silent> <Plug>HGDiff :HGDiff<CR> | |
|
1120 | nnoremap <silent> <Plug>HGGotoOriginal :HGGotoOriginal<CR> | |
|
1121 | nnoremap <silent> <Plug>HGClearAndGotoOriginal :HGGotoOriginal!<CR> | |
|
1122 | nnoremap <silent> <Plug>HGLog :HGLog<CR> | |
|
1123 | nnoremap <silent> <Plug>HGRevert :HGRevert<CR> | |
|
1124 | nnoremap <silent> <Plug>HGReview :HGReview<CR> | |
|
1125 | nnoremap <silent> <Plug>HGStatus :HGStatus<CR> | |
|
1126 | nnoremap <silent> <Plug>HGUpdate :HGUpdate<CR> | |
|
1127 | nnoremap <silent> <Plug>HGVimDiff :HGVimDiff<CR> | |
|
1128 | nnoremap <silent> <Plug>HGWatchers :HGWatchers<CR> | |
|
1129 | nnoremap <silent> <Plug>HGWatchAdd :HGWatchAdd<CR> | |
|
1130 | nnoremap <silent> <Plug>HGWatchOn :HGWatchOn<CR> | |
|
1131 | nnoremap <silent> <Plug>HGWatchOff :HGWatchOff<CR> | |
|
1132 | nnoremap <silent> <Plug>HGWatchRemove :HGWatchRemove<CR> | |
|
1229 | 1133 | |
|
1230 | 1134 | " Section: Default mappings {{{1 |
|
1231 |
if !hasmapto('<Plug> |
|
|
1232 |
nmap <unique> <Leader> |
|
|
1233 | endif | |
|
1234 | if !hasmapto('<Plug>CVSAnnotate') | |
|
1235 | nmap <unique> <Leader>cn <Plug>CVSAnnotate | |
|
1135 | if !hasmapto('<Plug>HGAdd') | |
|
1136 | nmap <unique> <Leader>hga <Plug>HGAdd | |
|
1236 | 1137 | endif |
|
1237 |
if !hasmapto('<Plug> |
|
|
1238 |
nmap <unique> <Leader> |
|
|
1138 | if !hasmapto('<Plug>HGAnnotate') | |
|
1139 | nmap <unique> <Leader>hgn <Plug>HGAnnotate | |
|
1239 | 1140 | endif |
|
1240 |
if !hasmapto('<Plug> |
|
|
1241 |
nmap <unique> <Leader> |
|
|
1242 | endif | |
|
1243 | if !hasmapto('<Plug>CVSDiff') | |
|
1244 | nmap <unique> <Leader>cd <Plug>CVSDiff | |
|
1141 | if !hasmapto('<Plug>HGClearAndGotoOriginal') | |
|
1142 | nmap <unique> <Leader>hgG <Plug>HGClearAndGotoOriginal | |
|
1245 | 1143 | endif |
|
1246 |
if !hasmapto('<Plug> |
|
|
1247 |
nmap <unique> <Leader>c |
|
|
1248 | endif | |
|
1249 | if !hasmapto('<Plug>CVSEditors') | |
|
1250 | nmap <unique> <Leader>ci <Plug>CVSEditors | |
|
1144 | if !hasmapto('<Plug>HGCommit') | |
|
1145 | nmap <unique> <Leader>hgc <Plug>HGCommit | |
|
1251 | 1146 | endif |
|
1252 |
if !hasmapto('<Plug> |
|
|
1253 |
nmap <unique> <Leader> |
|
|
1147 | if !hasmapto('<Plug>HGDiff') | |
|
1148 | nmap <unique> <Leader>hgd <Plug>HGDiff | |
|
1254 | 1149 | endif |
|
1255 |
if !hasmapto('<Plug> |
|
|
1256 |
nmap <unique> <Leader> |
|
|
1257 | endif | |
|
1258 | if !hasmapto('<Plug>CVSRevert') | |
|
1259 | nmap <unique> <Leader>cq <Plug>CVSRevert | |
|
1150 | if !hasmapto('<Plug>HGGotoOriginal') | |
|
1151 | nmap <unique> <Leader>hgg <Plug>HGGotoOriginal | |
|
1260 | 1152 | endif |
|
1261 |
if !hasmapto('<Plug> |
|
|
1262 |
nmap <unique> <Leader> |
|
|
1263 | endif | |
|
1264 | if !hasmapto('<Plug>CVSStatus') | |
|
1265 | nmap <unique> <Leader>cs <Plug>CVSStatus | |
|
1153 | if !hasmapto('<Plug>HGLog') | |
|
1154 | nmap <unique> <Leader>hgl <Plug>HGLog | |
|
1266 | 1155 | endif |
|
1267 |
if !hasmapto('<Plug> |
|
|
1268 |
nmap <unique> <Leader> |
|
|
1156 | if !hasmapto('<Plug>HGRevert') | |
|
1157 | nmap <unique> <Leader>hgq <Plug>HGRevert | |
|
1269 | 1158 | endif |
|
1270 |
if !hasmapto('<Plug> |
|
|
1271 |
nmap <unique> <Leader> |
|
|
1272 | endif | |
|
1273 | if !hasmapto('<Plug>CVSVimDiff') | |
|
1274 | nmap <unique> <Leader>cv <Plug>CVSVimDiff | |
|
1159 | if !hasmapto('<Plug>HGReview') | |
|
1160 | nmap <unique> <Leader>hgr <Plug>HGReview | |
|
1275 | 1161 | endif |
|
1276 |
if !hasmapto('<Plug> |
|
|
1277 |
nmap <unique> <Leader> |
|
|
1278 | endif | |
|
1279 | if !hasmapto('<Plug>CVSWatchAdd') | |
|
1280 | nmap <unique> <Leader>cwa <Plug>CVSWatchAdd | |
|
1162 | if !hasmapto('<Plug>HGStatus') | |
|
1163 | nmap <unique> <Leader>hgs <Plug>HGStatus | |
|
1281 | 1164 | endif |
|
1282 |
if !hasmapto('<Plug> |
|
|
1283 |
nmap <unique> <Leader> |
|
|
1165 | if !hasmapto('<Plug>HGUpdate') | |
|
1166 | nmap <unique> <Leader>hgu <Plug>HGUpdate | |
|
1284 | 1167 | endif |
|
1285 |
if !hasmapto('<Plug> |
|
|
1286 |
nmap <unique> <Leader> |
|
|
1287 | endif | |
|
1288 | if !hasmapto('<Plug>CVSWatchRemove') | |
|
1289 | nmap <unique> <Leader>cwr <Plug>CVSWatchRemove | |
|
1168 | if !hasmapto('<Plug>HGVimDiff') | |
|
1169 | nmap <unique> <Leader>hgv <Plug>HGVimDiff | |
|
1290 | 1170 | endif |
|
1291 | 1171 | |
|
1292 | 1172 | " Section: Menu items {{{1 |
|
1293 |
silent! aunmenu Plugin. |
|
|
1294 |
amenu <silent> &Plugin. |
|
|
1295 |
amenu <silent> &Plugin. |
|
|
1296 |
amenu <silent> &Plugin. |
|
|
1297 |
amenu <silent> &Plugin. |
|
|
1298 |
amenu <silent> &Plugin. |
|
|
1299 |
amenu <silent> &Plugin. |
|
|
1300 |
amenu <silent> &Plugin. |
|
|
1301 |
amenu <silent> &Plugin. |
|
|
1302 |
amenu <silent> &Plugin. |
|
|
1303 |
amenu <silent> &Plugin. |
|
|
1304 |
amenu <silent> &Plugin. |
|
|
1305 |
amenu <silent> &Plugin. |
|
|
1306 |
amenu <silent> &Plugin. |
|
|
1307 |
amenu <silent> &Plugin. |
|
|
1308 |
amenu <silent> &Plugin. |
|
|
1309 | amenu <silent> &Plugin.CVS.WatchOn <Plug>CVSWatchOn | |
|
1310 | amenu <silent> &Plugin.CVS.WatchOff <Plug>CVSWatchOff | |
|
1311 | amenu <silent> &Plugin.CVS.WatchRemove <Plug>CVSWatchRemove | |
|
1173 | silent! aunmenu Plugin.HG | |
|
1174 | amenu <silent> &Plugin.HG.&Add <Plug>HGAdd | |
|
1175 | amenu <silent> &Plugin.HG.A&nnotate <Plug>HGAnnotate | |
|
1176 | amenu <silent> &Plugin.HG.&Commit <Plug>HGCommit | |
|
1177 | amenu <silent> &Plugin.HG.&Diff <Plug>HGDiff | |
|
1178 | amenu <silent> &Plugin.HG.&Log <Plug>HGLog | |
|
1179 | amenu <silent> &Plugin.HG.Revert <Plug>HGRevert | |
|
1180 | amenu <silent> &Plugin.HG.&Review <Plug>HGReview | |
|
1181 | amenu <silent> &Plugin.HG.&Status <Plug>HGStatus | |
|
1182 | amenu <silent> &Plugin.HG.&Update <Plug>HGUpdate | |
|
1183 | amenu <silent> &Plugin.HG.&VimDiff <Plug>HGVimDiff | |
|
1184 | amenu <silent> &Plugin.HG.&Watchers <Plug>HGWatchers | |
|
1185 | amenu <silent> &Plugin.HG.WatchAdd <Plug>HGWatchAdd | |
|
1186 | amenu <silent> &Plugin.HG.WatchOn <Plug>HGWatchOn | |
|
1187 | amenu <silent> &Plugin.HG.WatchOff <Plug>HGWatchOff | |
|
1188 | amenu <silent> &Plugin.HG.WatchRemove <Plug>HGWatchRemove | |
|
1312 | 1189 | |
|
1313 | 1190 | " Section: Autocommands to restore vimdiff state {{{1 |
|
1314 |
function! s: |
|
|
1315 |
let s: |
|
|
1191 | function! s:HGVimDiffRestore(vimDiffBuff) | |
|
1192 | let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning + 1 | |
|
1316 | 1193 | try |
|
1317 | 1194 | if exists("s:vimDiffSourceBuffer") |
|
1318 | 1195 | if a:vimDiffBuff == s:vimDiffSourceBuffer |
@@ -1366,22 +1243,23 b' function! s:CVSVimDiffRestore(vimDiffBuf' | |||
|
1366 | 1243 | endif |
|
1367 | 1244 | endif |
|
1368 | 1245 | finally |
|
1369 |
let s: |
|
|
1246 | let s:HGCommandEditFileRunning = s:HGCommandEditFileRunning - 1 | |
|
1370 | 1247 | endtry |
|
1371 | 1248 | endfunction |
|
1372 | 1249 | |
|
1373 |
augroup |
|
|
1250 | augroup HGVimDiffRestore | |
|
1374 | 1251 | au! |
|
1375 |
au BufUnload * call s: |
|
|
1252 | au BufUnload * call s:HGVimDiffRestore(expand("<abuf>")) | |
|
1376 | 1253 | augroup END |
|
1377 | 1254 | |
|
1378 | 1255 | " Section: Optional activation of buffer management {{{1 |
|
1379 | 1256 | |
|
1380 |
if s: |
|
|
1381 |
call |
|
|
1257 | if s:HGGetOption('HGCommandEnableBufferSetup', 0) | |
|
1258 | call HGEnableBufferSetup() | |
|
1382 | 1259 | endif |
|
1383 | 1260 | |
|
1384 | 1261 | " Section: Plugin completion {{{1 |
|
1385 | 1262 | |
|
1386 |
let loaded_ |
|
|
1387 |
silent do |
|
|
1263 | let loaded_hgcommand=2 | |
|
1264 | silent do HGCommand User HGPluginFinish | |
|
1265 | " vim:se expandtab sts=2 sw=2: |
General Comments 0
You need to be logged in to leave comments.
Login now