20 " script has been copied in you .vim/plugin directory. |
20 " script has been copied in you .vim/plugin directory. |
21 " |
21 " |
22 " You still can read the documentation at the end of this file. Locate it by |
22 " You still can read the documentation at the end of this file. Locate it by |
23 " searching the "hgcommand-contents" string (and set ft=help to have |
23 " searching the "hgcommand-contents" string (and set ft=help to have |
24 " appropriate syntaxic coloration). |
24 " appropriate syntaxic coloration). |
25 " |
25 |
26 " Section: Documentation : detail {{{1 |
|
27 " |
|
28 " Provides functions to invoke various HG commands on the current file |
|
29 " (either the current buffer, or, in the case of an directory buffer, the file |
|
30 " on the current line). The output of the commands is captured in a new |
|
31 " scratch window. For convenience, if the functions are invoked on a HG |
|
32 " output window, the original file is used for the hg operation instead after |
|
33 " the window is split. This is primarily useful when running HGCommit and |
|
34 " you need to see the changes made, so that HGDiff is usable and shows up in |
|
35 " another window. |
|
36 " |
|
37 " Command documentation {{{2 |
|
38 " |
|
39 " HGAdd Performs "hg add" on the current file. |
|
40 " |
|
41 " HGAnnotate Performs "hg annotate" on the current file. If an |
|
42 " argument is given, the argument is used as a revision |
|
43 " number to display. If not given an argument, it uses the |
|
44 " most recent version of the file on the current branch. |
|
45 " Additionally, if the current buffer is a HGAnnotate buffer |
|
46 " already, the version number on the current line is used. |
|
47 " |
|
48 " If the 'HGCommandAnnotateParent' variable is set to a |
|
49 " non-zero value, the version previous to the one on the |
|
50 " current line is used instead. This allows one to navigate |
|
51 " back to examine the previous version of a line. |
|
52 " |
|
53 " HGCommit[!] If called with arguments, this performs "hg commit" using |
|
54 " the arguments as the log message. |
|
55 " |
|
56 " If '!' is used, an empty log message is committed. |
|
57 " |
|
58 " If called with no arguments, this is a two-step command. |
|
59 " The first step opens a buffer to accept a log message. |
|
60 " When that buffer is written, it is automatically closed and |
|
61 " the file is committed using the information from that log |
|
62 " message. The commit can be abandoned if the log message |
|
63 " buffer is deleted or wiped before being written. |
|
64 " |
|
65 " HGDiff With no arguments, this performs "hg diff" on the current |
|
66 " file. With one argument, "hg diff" is performed on the |
|
67 " current file against the specified revision. With two |
|
68 " arguments, hg diff is performed between the specified |
|
69 " revisions of the current file. This command uses the |
|
70 " 'HGCommandDiffOpt' variable to specify diff options. If |
|
71 " that variable does not exist, then 'wbBc' is assumed. If |
|
72 " you wish to have no options, then set it to the empty |
|
73 " string. |
|
74 " |
|
75 " HGGotoOriginal Returns the current window to the source buffer if the |
|
76 " current buffer is a HG output buffer. |
|
77 " |
|
78 " HGLog Performs "hg log" on the current file. |
|
79 " |
|
80 " HGRevert Replaces the modified version of the current file with the |
|
81 " most recent version from the repository. |
|
82 " |
|
83 " HGReview Retrieves a particular version of the current file. If no |
|
84 " argument is given, the most recent version of the file on |
|
85 " the current branch is retrieved. The specified revision is |
|
86 " retrieved into a new buffer. |
|
87 " |
|
88 " HGStatus Performs "hg status" on the current file. |
|
89 " |
|
90 " HGUpdate Performs "hg update" on the current file. |
|
91 " |
|
92 " HGVimDiff With no arguments, this prompts the user for a revision and |
|
93 " then uses vimdiff to display the differences between the |
|
94 " current file and the specified revision. If no revision is |
|
95 " specified, the most recent version of the file on the |
|
96 " current branch is used. With one argument, that argument |
|
97 " is used as the revision as above. With two arguments, the |
|
98 " differences between the two revisions is displayed using |
|
99 " vimdiff. |
|
100 " |
|
101 " With either zero or one argument, the original buffer is used |
|
102 " to perform the vimdiff. When the other buffer is closed, the |
|
103 " original buffer will be returned to normal mode. |
|
104 " |
|
105 " Once vimdiff mode is started using the above methods, |
|
106 " additional vimdiff buffers may be added by passing a single |
|
107 " version argument to the command. There may be up to 4 |
|
108 " vimdiff buffers total. |
|
109 " |
|
110 " Using the 2-argument form of the command resets the vimdiff |
|
111 " to only those 2 versions. Additionally, invoking the |
|
112 " command on a different file will close the previous vimdiff |
|
113 " buffers. |
|
114 " |
|
115 " |
|
116 " Mapping documentation: {{{2 |
|
117 " |
|
118 " By default, a mapping is defined for each command. User-provided mappings |
|
119 " can be used instead by mapping to <Plug>CommandName, for instance: |
|
120 " |
|
121 " nnoremap ,ca <Plug>HGAdd |
|
122 " |
|
123 " The default mappings are as follow: |
|
124 " |
|
125 " <Leader>hga HGAdd |
|
126 " <Leader>hgn HGAnnotate |
|
127 " <Leader>hgc HGCommit |
|
128 " <Leader>hgd HGDiff |
|
129 " <Leader>hgg HGGotoOriginal |
|
130 " <Leader>hgG HGGotoOriginal! |
|
131 " <Leader>hgl HGLog |
|
132 " <Leader>hgr HGReview |
|
133 " <Leader>hgs HGStatus |
|
134 " <Leader>hgu HGUpdate |
|
135 " <Leader>hgv HGVimDiff |
|
136 " |
|
137 " Options documentation: {{{2 |
|
138 " |
|
139 " Several variables are checked by the script to determine behavior as follow: |
|
140 " |
|
141 " HGCommandAnnotateParent |
|
142 " This variable, if set to a non-zero value, causes the zero-argument form |
|
143 " of HGAnnotate when invoked on a HGAnnotate buffer to go to the version |
|
144 " previous to that displayed on the current line. If not set, it defaults |
|
145 " to 0. |
|
146 " |
|
147 " HGCommandCommitOnWrite |
|
148 " This variable, if set to a non-zero value, causes the pending hg commit |
|
149 " to take place immediately as soon as the log message buffer is written. |
|
150 " If set to zero, only the HGCommit mapping will cause the pending commit |
|
151 " to occur. If not set, it defaults to 1. |
|
152 " |
|
153 " HGCommandDeleteOnHide |
|
154 " This variable, if set to a non-zero value, causes the temporary HG result |
|
155 " buffers to automatically delete themselves when hidden. |
|
156 " |
|
157 " HGCommandDiffOpt |
|
158 " This variable, if set, determines the options passed to the diff command |
|
159 " of HG. If not set, it defaults to 'wbBc'. |
|
160 " |
|
161 " HGCommandDiffSplit |
|
162 " This variable overrides the HGCommandSplit variable, but only for buffers |
|
163 " created with HGVimDiff. |
|
164 " |
|
165 " HGCommandEdit |
|
166 " This variable controls whether the original buffer is replaced ('edit') or |
|
167 " split ('split'). If not set, it defaults to 'edit'. |
|
168 " |
|
169 " HGCommandEnableBufferSetup |
|
170 " This variable, if set to a non-zero value, activates HG buffer management |
|
171 " mode. This mode means that two buffer variables, 'HGRevision' and |
|
172 " 'HGBranch', are set if the file is HG-controlled. This is useful for |
|
173 " displaying version information in the status bar. |
|
174 " |
|
175 " HGCommandInteractive |
|
176 " This variable, if set to a non-zero value, causes appropriate functions (for |
|
177 " the moment, only HGReview) to query the user for a revision to use |
|
178 " instead of the current revision if none is specified. |
|
179 " |
|
180 " HGCommandNameMarker |
|
181 " This variable, if set, configures the special attention-getting characters |
|
182 " that appear on either side of the hg buffer type in the buffer name. |
|
183 " This has no effect unless 'HGCommandNameResultBuffers' is set to a true |
|
184 " value. If not set, it defaults to '_'. |
|
185 " |
|
186 " HGCommandNameResultBuffers |
|
187 " This variable, if set to a true value, causes the hg result buffers to be |
|
188 " named in the old way ('<source file name> _<hg command>_'). If not set |
|
189 " or set to a false value, the result buffer is nameless. |
|
190 " |
|
191 " HGCommandSplit |
|
192 " This variable controls the orientation of the various window splits that |
|
193 " may occur (such as with HGVimDiff, when using a HG command on a HG |
|
194 " command buffer, or when the 'HGCommandEdit' variable is set to 'split'. |
|
195 " If set to 'horizontal', the resulting windows will be on stacked on top of |
|
196 " one another. If set to 'vertical', the resulting windows will be |
|
197 " side-by-side. If not set, it defaults to 'horizontal' for all but |
|
198 " HGVimDiff windows. |
|
199 " |
|
200 " Event documentation {{{2 |
|
201 " For additional customization, hgcommand.vim uses User event autocommand |
|
202 " hooks. Each event is in the HGCommand group, and different patterns |
|
203 " match the various hooks. |
|
204 " |
|
205 " For instance, the following could be added to the vimrc to provide a 'q' |
|
206 " mapping to quit a HG buffer: |
|
207 " |
|
208 " augroup HGCommand |
|
209 " au HGCommand User HGBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr> |
|
210 " augroup END |
|
211 " |
|
212 " The following hooks are available: |
|
213 " |
|
214 " HGBufferCreated This event is fired just after a hg command |
|
215 " result buffer is created and filled with the |
|
216 " result of a hg command. It is executed within |
|
217 " the context of the new buffer. |
|
218 " |
|
219 " HGBufferSetup This event is fired just after HG buffer setup |
|
220 " occurs, if enabled. |
|
221 " |
|
222 " HGPluginInit This event is fired when the HGCommand plugin |
|
223 " first loads. |
|
224 " |
|
225 " HGPluginFinish This event is fired just after the HGCommand |
|
226 " plugin loads. |
|
227 " |
|
228 " HGVimDiffFinish This event is fired just after the HGVimDiff |
|
229 " command executes to allow customization of, |
|
230 " for instance, window placement and focus. |
|
231 " |
|
232 " Section: Plugin header {{{1 |
26 " Section: Plugin header {{{1 |
233 |
27 |
234 " loaded_hgcommand is set to 1 when the initialization begins, and 2 when it |
28 " loaded_hgcommand is set to 1 when the initialization begins, and 2 when it |
235 " completes. This allows various actions to only be taken by functions after |
29 " completes. This allows various actions to only be taken by functions after |
236 " system initialization. |
30 " system initialization. |
1420 Mercurial: http://www.selenic.com/mercurial |
1214 Mercurial: http://www.selenic.com/mercurial |
1421 Mercurial (noted Hg) is a fast, lightweight Source Control Management |
1215 Mercurial (noted Hg) is a fast, lightweight Source Control Management |
1422 system designed for efficient handling of very large distributed projects. |
1216 system designed for efficient handling of very large distributed projects. |
1423 |
1217 |
1424 ============================================================================== |
1218 ============================================================================== |
1425 1. Contents *hgcommand-contents* |
1219 1. Contents *hgcommand-contents* |
1426 |
1220 |
1427 Installation : |hgcommand-install| |
1221 Installation : |hgcommand-install| |
1428 HGCommand Intro : |hgcommand| |
1222 HGCommand Intro : |hgcommand| |
1429 HGCommand Manual : |hgcommand-manual| |
1223 HGCommand Manual : |hgcommand-manual| |
1430 Customization : |hgcommand-customize| |
1224 Customization : |hgcommand-customize| |
1431 SSH "integration" : |hgcommand-ssh| |
|
1432 Bugs : |hgcommand-bugs| |
1225 Bugs : |hgcommand-bugs| |
1433 |
1226 |
1434 ============================================================================== |
1227 ============================================================================== |
1435 *hgcommand-install* |
1228 2. HGCommand Installation *hgcommand-install* |
1436 2. HGCommand Installation |
|
1437 |
1229 |
1438 In order to install the plugin, place the hgcommand.vim file into a plugin' |
1230 In order to install the plugin, place the hgcommand.vim file into a plugin' |
1439 directory in your runtime path (please see |add-global-plugin| and |
1231 directory in your runtime path (please see |add-global-plugin| and |
1440 |'runtimepath'|. |
1232 |'runtimepath'|. |
1441 |
1233 |
1442 HGCommand may be customized by setting variables, creating maps, and |
1234 HGCommand may be customized by setting variables, creating maps, and |
1443 specifying event handlers. Please see |hgcommand-customize| for more |
1235 specifying event handlers. Please see |hgcommand-customize| for more |
1444 details. |
1236 details. |
1445 |
1237 |
1446 *hgcommand-auto-help* |
1238 *hgcommand-auto-help* |
1447 The help file is automagically generated when the |vimspell| script is |
1239 The help file is automagically generated when the |hgcommand| script is |
1448 loaded for the first time. |
1240 loaded for the first time. |
1449 |
1241 |
1450 ============================================================================== |
1242 ============================================================================== |
1451 |
1243 |
1452 3. HGCommand Intro *hgcommand* |
1244 3. HGCommand Intro *hgcommand* |
1453 *hgcommand-intro* |
1245 *hgcommand-intro* |
1454 |
1246 |
1455 The HGCommand plugin provides global ex commands for manipulating |
1247 The HGCommand plugin provides global ex commands for manipulating |
1456 HG-controlled source files. In general, each command operates on the current |
1248 HG-controlled source files. In general, each command operates on the |
1457 buffer and accomplishes a separate hg function, such as update, commit, log, |
1249 current buffer and accomplishes a separate hg function, such as update, |
1458 and others (please see |hgcommand-commands| for a list of all available |
1250 commit, log, and others (please see |hgcommand-commands| for a list of all |
1459 commands). The results of each operation are displayed in a scratch buffer. |
1251 available commands). The results of each operation are displayed in a |
1460 Several buffer variables are defined for those scratch buffers (please see |
1252 scratch buffer. Several buffer variables are defined for those scratch |
1461 |hgcommand-buffer-variables|). |
1253 buffers (please see |hgcommand-buffer-variables|). |
1462 |
1254 |
1463 The notion of "current file" means either the current buffer, or, in the case |
1255 The notion of "current file" means either the current buffer, or, in the |
1464 of a directory buffer, the file on the current line within the buffer. |
1256 case of a directory buffer, the file on the current line within the buffer. |
1465 |
1257 |
1466 For convenience, any HGCommand invoked on a HGCommand scratch buffer acts as |
1258 For convenience, any HGCommand invoked on a HGCommand scratch buffer acts |
1467 though it was invoked on the original file and splits the screen so that the |
1259 as though it was invoked on the original file and splits the screen so that |
1468 output appears in a new window. |
1260 the output appears in a new window. |
1469 |
1261 |
1470 Many of the commands accept revisions as arguments. By default, most operate |
1262 Many of the commands accept revisions as arguments. By default, most |
1471 on the most recent revision on the current branch if no revision is specified |
1263 operate on the most recent revision on the current branch if no revision is |
1472 (though see |HGCommandInteractive| to prompt instead). |
1264 specified (though see |HGCommandInteractive| to prompt instead). |
1473 |
1265 |
1474 Each HGCommand is mapped to a key sequence starting with the <Leader> |
1266 Each HGCommand is mapped to a key sequence starting with the <Leader> |
1475 keystroke. The default mappings may be overridden by supplying different |
1267 keystroke. The default mappings may be overridden by supplying different |
1476 mappings before the plugin is loaded, such as in the vimrc, in the standard |
1268 mappings before the plugin is loaded, such as in the vimrc, in the standard |
1477 fashion for plugin mappings. For examples, please see |
1269 fashion for plugin mappings. For examples, please see |
1478 |hgcommand-mappings-override|. |
1270 |hgcommand-mappings-override|. |
1479 |
1271 |
1480 The HGCommand plugin may be configured in several ways. For more details, |
1272 The HGCommand plugin may be configured in several ways. For more details, |
1481 please see |hgcommand-customize|. |
1273 please see |hgcommand-customize|. |
1482 |
1274 |
1483 ============================================================================== |
1275 ============================================================================== |
1484 |
1276 4. HGCommand Manual *hgcommand-manual* |
1485 4. HGCommand Manual *hgcommand-manual* |
1277 |
1486 |
1278 4.1 HGCommand commands *hgcommand-commands* |
1487 4.1 HGCommand commands *hgcommand-commands* |
1279 |
1488 |
1280 HGCommand defines the following commands: |
1489 HGCommand defines the following commands: |
1281 |
1490 |
1282 |:HGAdd| |
1491 |:HGAdd| |
1283 |:HGAnnotate| |
1492 |:HGAnnotate| |
1284 |:HGCommit| |
1493 |:HGCommit| |
1285 |:HGDiff| |
1494 |:HGDiff| |
1286 |:HGGotoOriginal| |
1495 |:HGGotoOriginal| |
1287 |:HGLog| |
1496 |:HGLog| |
1288 |:HGRevert| |
1497 |:HGRevert| |
1289 |:HGReview| |
1498 |:HGReview| |
1290 |:HGStatus| |
1499 |:HGStatus| |
1291 |:HGUpdate| |
1500 |:HGUnedit| |
1292 |:HGVimDiff| |
1501 |:HGUpdate| |
1293 |
1502 |:HGVimDiff| |
1294 :HGAdd *:HGAdd* |
1503 |
1295 |
1504 :HGAdd *:HGAdd* |
1296 This command performs "hg add" on the current file. Please note, this does |
1505 |
1297 not commit the newly-added file. |
1506 This command performs "hg add" on the current file. Please note, this does |
1298 |
1507 not commit the newly-added file. |
1299 :HGAnnotate *:HGAnnotate* |
1508 |
1300 |
1509 :HGAnnotate *:HGAnnotate* |
1301 This command performs "hg annotate" on the current file. If an argument is |
1510 |
1302 given, the argument is used as a revision number to display. If not given |
1511 This command performs "hg annotate" on the current file. If an argument is |
1303 an argument, it uses the most recent version of the file on the current |
1512 given, the argument is used as a revision number to display. If not given an |
1304 branch. Additionally, if the current buffer is a HGAnnotate buffer |
1513 argument, it uses the most recent version of the file on the current branch. |
1305 already, the version number on the current line is used. |
1514 Additionally, if the current buffer is a HGAnnotate buffer already, the |
1306 |
1515 version number on the current line is used. |
1307 If the |HGCommandAnnotateParent| variable is set to a non-zero value, the |
1516 |
1308 version previous to the one on the current line is used instead. This |
1517 If the |HGCommandAnnotateParent| variable is set to a non-zero value, the |
1309 allows one to navigate back to examine the previous version of a line. |
1518 version previous to the one on the current line is used instead. This allows |
1310 |
1519 one to navigate back to examine the previous version of a line. |
1311 The filetype of the HGCommand scratch buffer is set to 'HGAnnotate', to |
1520 |
1312 take advantage of the bundled syntax file. |
1521 The filetype of the HGCommand scratch buffer is set to 'HGAnnotate', to take |
1313 |
1522 advantage of the bundled syntax file. |
1314 |
1523 |
1315 :HGCommit[!] *:HGCommit* |
1524 |
1316 |
1525 :HGCommit[!] *:HGCommit* |
1317 If called with arguments, this performs "hg commit" using the arguments as |
1526 |
1318 the log message. |
1527 If called with arguments, this performs "hg commit" using the arguments as |
1319 |
1528 the log message. |
1320 If '!' is used with no arguments, an empty log message is committed. |
1529 |
1321 |
1530 If '!' is used with no arguments, an empty log message is committed. |
1322 If called with no arguments, this is a two-step command. The first step |
1531 |
1323 opens a buffer to accept a log message. When that buffer is written, it is |
1532 If called with no arguments, this is a two-step command. The first step opens |
1324 automatically closed and the file is committed using the information from |
1533 a buffer to accept a log message. When that buffer is written, it is |
1325 that log message. The commit can be abandoned if the log message buffer is |
1534 automatically closed and the file is committed using the information from that |
1326 deleted or wiped before being written. |
1535 log message. The commit can be abandoned if the log message buffer is deleted |
1327 |
1536 or wiped before being written. |
1328 Alternatively, the mapping that is used to invoke :HGCommit (by default |
1537 |
1329 <Leader>hgc) can be used in the log message buffer to immediately commit. |
1538 Alternatively, the mapping that is used to invoke :HGCommit (by default |
1330 This is useful if the |HGCommandCommitOnWrite| variable is set to 0 to |
1539 <Leader>hgc) can be used in the log message buffer to immediately commit. |
1331 disable the normal commit-on-write behavior. |
1540 This |
1332 |
1541 is useful if the |HGCommandCommitOnWrite| variable is set to 0 to disable the |
1333 :HGDiff *:HGDiff* |
1542 normal commit-on-write behavior. |
1334 |
1543 |
1335 With no arguments, this performs "hg diff" on the current file against the |
1544 :HGDiff *:HGDiff* |
1336 current repository version. |
1545 |
1337 |
1546 With no arguments, this performs "hg diff" on the current file against the |
1338 With one argument, "hg diff" is performed on the current file against the |
1547 current repository version. |
1339 specified revision. |
1548 |
1340 |
1549 With one argument, "hg diff" is performed on the current file against the |
1341 With two arguments, hg diff is performed between the specified revisions of |
1550 specified revision. |
1342 the current file. |
1551 |
1343 |
1552 With two arguments, hg diff is performed between the specified |
1344 This command uses the 'HGCommandDiffOpt' variable to specify diff options. |
1553 revisions of the current file. |
1345 If that variable does not exist, then 'wbBc' is assumed. If you wish to |
1554 |
1346 have no options, then set it to the empty string. |
1555 This command uses the 'HGCommandDiffOpt' variable to specify diff options. |
1347 |
1556 If that variable does not exist, then 'wbBc' is assumed. If you wish to have |
1348 |
1557 no options, then set it to the empty string. |
1349 :HGGotoOriginal *:HGGotoOriginal* |
1558 |
1350 |
1559 |
1351 This command returns the current window to the source buffer, if the |
1560 This command performs "hg edit" on the current file. |
1352 current buffer is a HG command output buffer. |
1561 |
|
1562 :HGGotoOriginal *:HGGotoOriginal* |
|
1563 |
|
1564 This command returns the current window to the source buffer, if the current |
|
1565 buffer is a HG command output buffer. |
|
1566 |
1353 |
1567 :HGGotoOriginal! |
1354 :HGGotoOriginal! |
1568 |
1355 |
1569 Like ":HGGotoOriginal" but also executes :bufwipeout on all HG command |
1356 Like ":HGGotoOriginal" but also executes :bufwipeout on all HG command |
1570 output buffers for the source buffer. |
1357 output buffers for the source buffer. |
1571 |
1358 |
1572 :HGLog *:HGLog* |
1359 :HGLog *:HGLog* |
1573 |
1360 |
1574 Performs "hg log" on the current file. |
1361 Performs "hg log" on the current file. |
1575 |
1362 |
1576 If an argument is given, it is passed as an argument to the "-r" option of |
1363 If an argument is given, it is passed as an argument to the "-r" option of |
1577 "hg log". |
1364 "hg log". |
1578 |
1365 |
1579 :HGRevert *:HGRevert* |
1366 :HGRevert *:HGRevert* |
1580 |
1367 |
1581 Replaces the current file with the most recent version from the repository in |
1368 Replaces the current file with the most recent version from the repository |
1582 order to wipe out any undesired changes. |
1369 in order to wipe out any undesired changes. |
1583 |
1370 |
1584 :HGReview *:HGReview* |
1371 :HGReview *:HGReview* |
1585 |
1372 |
1586 Retrieves a particular version of the current file. If no argument is given, |
1373 Retrieves a particular version of the current file. If no argument is |
1587 the most recent version of the file on the current branch is retrieved. |
1374 given, the most recent version of the file on the current branch is |
1588 Otherwise, the specified version is retrieved. |
1375 retrieved. Otherwise, the specified version is retrieved. |
1589 |
1376 |
1590 :HGStatus *:HGStatus* |
1377 :HGStatus *:HGStatus* |
1591 |
1378 |
1592 Performs "hg status" on the current file. |
1379 Performs "hg status" on the current file. |
1593 |
1380 |
1594 :HGUnedit *:HGUnedit* |
1381 :HGUpdate *:HGUpdate* |
1595 |
1382 |
1596 Performs "hg unedit" on the current file. Again, yes, the output buffer here |
1383 Performs "hg update" on the current file. This intentionally does not |
1597 is basically useless. |
1384 automatically reload the current buffer, though vim should prompt the user |
1598 |
1385 to do so if the underlying file is altered by this command. |
1599 :HGUpdate *:HGUpdate* |
1386 |
1600 |
1387 :HGVimDiff *:HGVimDiff* |
1601 Performs "hg update" on the current file. This intentionally does not |
1388 |
1602 automatically reload the current buffer, though vim should prompt the user to |
1389 With no arguments, this prompts the user for a revision and then uses |
1603 do so if the underlying file is altered by this command. |
1390 vimdiff to display the differences between the current file and the |
1604 |
1391 specified revision. If no revision is specified, the most recent version |
1605 :HGVimDiff *:HGVimDiff* |
1392 of the file on the current branch is used. |
1606 |
1393 |
1607 With no arguments, this prompts the user for a revision and then uses vimdiff |
1394 With one argument, that argument is used as the revision as above. With |
1608 to display the differences between the current file and the specified |
1395 two arguments, the differences between the two revisions is displayed using |
1609 revision. If no revision is specified, the most recent version of the file on |
1396 vimdiff. |
1610 the current branch is used. |
1397 |
1611 |
1398 With either zero or one argument, the original buffer is used to perform |
1612 With one argument, that argument is used as the revision as above. With two |
1399 the vimdiff. When the other buffer is closed, the original buffer will be |
1613 arguments, the differences between the two revisions is displayed using |
1400 returned to normal mode. |
1614 vimdiff. |
1401 |
1615 |
1402 Once vimdiff mode is started using the above methods, additional vimdiff |
1616 With either zero or one argument, the original buffer is used to perform the |
1403 buffers may be added by passing a single version argument to the command. |
1617 vimdiff. When the other buffer is closed, the original buffer will be |
1404 There may be up to 4 vimdiff buffers total. |
1618 returned to normal mode. |
1405 |
1619 |
1406 Using the 2-argument form of the command resets the vimdiff to only those 2 |
1620 Once vimdiff mode is started using the above methods, additional vimdiff |
1407 versions. Additionally, invoking the command on a different file will |
1621 buffers may be added by passing a single version argument to the command. |
1408 close the previous vimdiff buffers. |
1622 There may be up to 4 vimdiff buffers total. |
1409 |
1623 |
1410 |
1624 Using the 2-argument form of the command resets the vimdiff to only those 2 |
1411 4.2 Mappings *hgcommand-mappings* |
1625 versions. Additionally, invoking the command on a different file will close |
1412 |
1626 the previous vimdiff buffers. |
1413 By default, a mapping is defined for each command. These mappings execute |
1627 |
1414 the default (no-argument) form of each command. |
1628 |
1415 |
1629 4.2 Mappings *hgcommand-mappings* |
1416 <Leader>hga HGAdd |
1630 |
1417 <Leader>hgn HGAnnotate |
1631 By default, a mapping is defined for each command. These mappings execute the |
1418 <Leader>hgc HGCommit |
1632 default (no-argument) form of each command. |
1419 <Leader>hgd HGDiff |
1633 |
1420 <Leader>hgg HGGotoOriginal |
1634 <Leader>hga HGAdd |
1421 <Leader>hgG HGGotoOriginal! |
1635 <Leader>hgn HGAnnotate |
1422 <Leader>hgl HGLog |
1636 <Leader>hgc HGCommit |
1423 <Leader>hgr HGReview |
1637 <Leader>hgd HGDiff |
1424 <Leader>hgs HGStatus |
1638 <Leader>hgg HGGotoOriginal |
1425 <Leader>hgu HGUpdate |
1639 <Leader>hgG HGGotoOriginal! |
1426 <Leader>hgv HGVimDiff |
1640 <Leader>hgl HGLog |
1427 |
1641 <Leader>hgr HGReview |
1428 *hgcommand-mappings-override* |
1642 <Leader>hgs HGStatus |
1429 |
1643 <Leader>hgt HGUnedit |
1430 The default mappings can be overriden by user-provided instead by mapping |
1644 <Leader>hgu HGUpdate |
1431 to <Plug>CommandName. This is especially useful when these mappings |
1645 <Leader>hgv HGVimDiff |
1432 collide with other existing mappings (vim will warn of this during plugin |
1646 |
1433 initialization, but will not clobber the existing mappings). |
1647 *hgcommand-mappings-override* |
1434 |
1648 |
1435 For instance, to override the default mapping for :HGAdd to set it to |
1649 The default mappings can be overriden by user-provided instead by mapping to |
1436 '\add', add the following to the vimrc: > |
1650 <Plug>CommandName. This is especially useful when these mappings collide with |
1437 |
1651 other existing mappings (vim will warn of this during plugin initialization, |
1438 nmap \add <Plug>HGAdd |
1652 but will not clobber the existing mappings). |
1439 < |
1653 |
1440 4.3 Automatic buffer variables *hgcommand-buffer-variables* |
1654 For instance, to override the default mapping for :HGAdd to set it to '\add', |
1441 |
1655 add the following to the vimrc: |
1442 Several buffer variables are defined in each HGCommand result buffer. |
1656 |
1443 These may be useful for additional customization in callbacks defined in |
1657 nmap \add <Plug>HGAdd |
1444 the event handlers (please see |hgcommand-events|). |
1658 |
1445 |
1659 4.3 Automatic buffer variables *hgcommand-buffer-variables* |
1446 The following variables are automatically defined: |
1660 |
1447 |
1661 Several buffer variables are defined in each HGCommand result buffer. These |
1448 b:hgOrigBuffNR *b:hgOrigBuffNR* |
1662 may be useful for additional customization in callbacks defined in the event |
1449 |
1663 handlers (please see |hgcommand-events|). |
1450 This variable is set to the buffer number of the source file. |
1664 |
1451 |
1665 The following variables are automatically defined: |
1452 b:hgcmd *b:hgcmd* |
1666 |
1453 |
1667 b:hgOrigBuffNR *b:hgOrigBuffNR* |
1454 This variable is set to the name of the hg command that created the result |
1668 |
1455 buffer. |
1669 This variable is set to the buffer number of the source file. |
|
1670 |
|
1671 b:hgcmd *b:hgcmd* |
|
1672 |
|
1673 This variable is set to the name of the hg command that created the result |
|
1674 buffer. |
|
1675 ============================================================================== |
1456 ============================================================================== |
1676 |
1457 |
1677 5. Configuration and customization *hgcommand-customize* |
1458 5. Configuration and customization *hgcommand-customize* |
1678 *hgcommand-config* |
1459 *hgcommand-config* |
1679 |
1460 |
1680 The HGCommand plugin can be configured in two ways: by setting configuration |
1461 The HGCommand plugin can be configured in two ways: by setting |
1681 variables (see |hgcommand-options|) or by defining HGCommand event handlers |
1462 configuration variables (see |hgcommand-options|) or by defining HGCommand |
1682 (see |hgcommand-events|). Additionally, the HGCommand plugin provides |
1463 event handlers (see |hgcommand-events|). Additionally, the HGCommand |
1683 several option for naming the HG result buffers (see |hgcommand-naming|) and |
1464 plugin provides several option for naming the HG result buffers (see |
1684 supported a customized status line (see |hgcommand-statusline| and |
1465 |hgcommand-naming|) and supported a customized status line (see |
1685 |hgcommand-buffer-management|). |
1466 |hgcommand-statusline| and |hgcommand-buffer-management|). |
1686 |
1467 |
1687 5.1 HGCommand configuration variables *hgcommand-options* |
1468 5.1 HGCommand configuration variables *hgcommand-options* |
1688 |
1469 |
1689 Several variables affect the plugin's behavior. These variables are checked |
1470 Several variables affect the plugin's behavior. These variables are |
1690 at time of execution, and may be defined at the window, buffer, or global |
1471 checked at time of execution, and may be defined at the window, buffer, or |
1691 level and are checked in that order of precedence. |
1472 global level and are checked in that order of precedence. |
1692 |
1473 |
1693 |
1474 |
1694 The following variables are available: |
1475 The following variables are available: |
1695 |
1476 |
1696 |HGCommandAnnotateParent| |
1477 |HGCommandAnnotateParent| |
1697 |HGCommandCommitOnWrite| |
1478 |HGCommandCommitOnWrite| |
1698 |HGCommandHGExec| |
1479 |HGCommandHGExec| |
1699 |HGCommandDeleteOnHide| |
1480 |HGCommandDeleteOnHide| |
1700 |HGCommandDiffOpt| |
1481 |HGCommandDiffOpt| |
1701 |HGCommandDiffSplit| |
1482 |HGCommandDiffSplit| |
1702 |HGCommandEdit| |
1483 |HGCommandEdit| |
1703 |HGCommandEnableBufferSetup| |
1484 |HGCommandEnableBufferSetup| |
1704 |HGCommandInteractive| |
1485 |HGCommandInteractive| |
1705 |HGCommandNameMarker| |
1486 |HGCommandNameMarker| |
1706 |HGCommandNameResultBuffers| |
1487 |HGCommandNameResultBuffers| |
1707 |HGCommandSplit| |
1488 |HGCommandSplit| |
1708 |
1489 |
1709 HGCommandAnnotateParent *HGCommandAnnotateParent* |
1490 HGCommandAnnotateParent *HGCommandAnnotateParent* |
1710 |
1491 |
1711 This variable, if set to a non-zero value, causes the zero-argument form of |
1492 This variable, if set to a non-zero value, causes the zero-argument form of |
1712 HGAnnotate when invoked on a HGAnnotate buffer to go to the version previous |
1493 HGAnnotate when invoked on a HGAnnotate buffer to go to the version |
1713 to that displayed on the current line. If not set, it defaults to 0. |
1494 previous to that displayed on the current line. If not set, it defaults to |
1714 |
1495 0. |
1715 HGCommandCommitOnWrite *HGCommandCommitOnWrite* |
1496 |
1716 |
1497 HGCommandCommitOnWrite *HGCommandCommitOnWrite* |
1717 This variable, if set to a non-zero value, causes the pending hg commit |
1498 |
1718 to take place immediately as soon as the log message buffer is written. |
1499 This variable, if set to a non-zero value, causes the pending hg commit to |
1719 If set to zero, only the HGCommit mapping will cause the pending commit to |
1500 take place immediately as soon as the log message buffer is written. If |
1720 occur. If not set, it defaults to 1. |
1501 set to zero, only the HGCommit mapping will cause the pending commit to |
1721 |
1502 occur. If not set, it defaults to 1. |
1722 HGCommandHGExec *HGCommandHGExec* |
1503 |
1723 |
1504 HGCommandHGExec *HGCommandHGExec* |
1724 This variable controls the executable used for all HG commands If not set, |
1505 |
1725 it defaults to "hg". |
1506 This variable controls the executable used for all HG commands. If not |
1726 |
1507 set, it defaults to "hg". |
1727 HGCommandDeleteOnHide *HGCommandDeleteOnHide* |
1508 |
1728 |
1509 HGCommandDeleteOnHide *HGCommandDeleteOnHide* |
1729 This variable, if set to a non-zero value, causes the temporary HG result |
1510 |
1730 buffers to automatically delete themselves when hidden. |
1511 This variable, if set to a non-zero value, causes the temporary HG result |
1731 |
1512 buffers to automatically delete themselves when hidden. |
1732 HGCommandDiffOpt *HGCommandDiffOpt* |
1513 |
1733 |
1514 HGCommandDiffOpt *HGCommandDiffOpt* |
1734 This variable, if set, determines the options passed to the diff command of |
1515 |
1735 HG. If not set, it defaults to 'wbBc'. |
1516 This variable, if set, determines the options passed to the diff command of |
1736 |
1517 HG. If not set, it defaults to 'w'. |
1737 HGCommandDiffSplit *HGCommandDiffSplit* |
1518 |
1738 |
1519 HGCommandDiffSplit *HGCommandDiffSplit* |
1739 This variable overrides the |HGCommandSplit| variable, but only for buffers |
1520 |
1740 created with |:HGVimDiff|. |
1521 This variable overrides the |HGCommandSplit| variable, but only for buffers |
1741 |
1522 created with |:HGVimDiff|. |
1742 HGCommandEdit *HGCommandEdit* |
1523 |
1743 |
1524 HGCommandEdit *HGCommandEdit* |
1744 This variable controls whether the original buffer is replaced ('edit') or |
1525 |
1745 split ('split'). If not set, it defaults to 'edit'. |
1526 This variable controls whether the original buffer is replaced ('edit') or |
1746 |
1527 split ('split'). If not set, it defaults to 'edit'. |
1747 HGCommandEnableBufferSetup *HGCommandEnableBufferSetup* |
1528 |
1748 |
1529 HGCommandEnableBufferSetup *HGCommandEnableBufferSetup* |
1749 This variable, if set to a non-zero value, activates HG buffer management |
1530 |
1750 mode see (|hgcommand-buffer-management|). This mode means that two buffer |
1531 This variable, if set to a non-zero value, activates HG buffer management |
1751 variables, 'HGRevision' and 'HGBranch', are set if the file is |
1532 mode see (|hgcommand-buffer-management|). This mode means that three |
1752 HG-controlled. This is useful for displaying version information in the |
1533 buffer variables, 'HGRepository', 'HGRevision' and 'HGBranch', are set if |
1753 status bar. |
1534 the file is HG-controlled. This is useful for displaying version |
1754 |
1535 information in the status bar. |
1755 HGCommandInteractive *HGCommandInteractive* |
1536 |
1756 |
1537 HGCommandInteractive *HGCommandInteractive* |
1757 This variable, if set to a non-zero value, causes appropriate commands (for |
1538 |
1758 the moment, only |:HGReview|) to query the user for a revision to use instead |
1539 This variable, if set to a non-zero value, causes appropriate commands (for |
1759 of the current revision if none is specified. |
1540 the moment, only |:HGReview|) to query the user for a revision to use |
1760 |
1541 instead of the current revision if none is specified. |
1761 HGCommandNameMarker *HGCommandNameMarker* |
1542 |
1762 |
1543 HGCommandNameMarker *HGCommandNameMarker* |
1763 This variable, if set, configures the special attention-getting characters |
1544 |
1764 that appear on either side of the hg buffer type in the buffer name. This |
1545 This variable, if set, configures the special attention-getting characters |
1765 has no effect unless |HGCommandNameResultBuffers| is set to a true value. If |
1546 that appear on either side of the hg buffer type in the buffer name. This |
1766 not set, it defaults to '_'. |
1547 has no effect unless |HGCommandNameResultBuffers| is set to a true value. |
1767 |
1548 If not set, it defaults to '_'. |
1768 HGCommandNameResultBuffers *HGCommandNameResultBuffers* |
1549 |
1769 |
1550 HGCommandNameResultBuffers *HGCommandNameResultBuffers* |
1770 This variable, if set to a true value, causes the hg result buffers to be |
1551 |
1771 named in the old way ('<source file name> _<hg command>_'). If not set |
1552 This variable, if set to a true value, causes the hg result buffers to be |
1772 or set to a false value, the result buffer is nameless. |
1553 named in the old way ('<source file name> _<hg command>_'). If not set or |
1773 |
1554 set to a false value, the result buffer is nameless. |
1774 HGCommandSplit *HGCommandSplit* |
1555 |
1775 |
1556 HGCommandSplit *HGCommandSplit* |
1776 This variable controls the orientation of the various window splits that |
1557 |
1777 may occur (such as with HGVimDiff, when using a HG command on a HG |
1558 This variable controls the orientation of the various window splits that |
1778 command buffer, or when the |HGCommandEdit| variable is set to 'split'. |
1559 may occur (such as with HGVimDiff, when using a HG command on a HG command |
1779 If set to 'horizontal', the resulting windows will be on stacked on top of |
1560 buffer, or when the |HGCommandEdit| variable is set to 'split'. If set to |
1780 one another. If set to 'vertical', the resulting windows will be |
1561 'horizontal', the resulting windows will be on stacked on top of one |
1781 side-by-side. If not set, it defaults to 'horizontal' for all but |
1562 another. If set to 'vertical', the resulting windows will be side-by-side. |
1782 HGVimDiff windows. |
1563 If not set, it defaults to 'horizontal' for all but HGVimDiff windows. |
1783 |
1564 |
1784 5.2 HGCommand events *hgcommand-events* |
1565 5.2 HGCommand events *hgcommand-events* |
1785 |
1566 |
1786 For additional customization, HGCommand can trigger user-defined events. |
1567 For additional customization, HGCommand can trigger user-defined events. |
1787 Event handlers are provided by defining User event autocommands (see |
1568 Event handlers are provided by defining User event autocommands (see |
1788 |autocommand|, |User|) in the HGCommand group with patterns matching the |
1569 |autocommand|, |User|) in the HGCommand group with patterns matching the |
1789 event name. |
1570 event name. |
1790 |
1571 |
1791 For instance, the following could be added to the vimrc to provide a 'q' |
1572 For instance, the following could be added to the vimrc to provide a 'q' |
1792 mapping to quit a HGCommand scratch buffer: |
1573 mapping to quit a HGCommand scratch buffer: > |
1793 |
1574 |
1794 augroup HGCommand |
1575 augroup HGCommand |
1795 au HGCommand User HGBufferCreated silent! nmap <unique> <buffer> q: bwipeout<cr> |
1576 au HGCommand User HGBufferCreated silent! nmap <unique> <buffer> q: |
1796 augroup END |
1577 bwipeout<cr> |
1797 |
1578 augroup END |
1798 The following hooks are available: |
1579 < |
1799 |
1580 |
1800 HGBufferCreated This event is fired just after a hg command |
1581 The following hooks are available: |
1801 result buffer is created and filled with the |
1582 |
1802 result of a hg command. It is executed within |
1583 HGBufferCreated This event is fired just after a hg command result |
1803 the context of the HG command buffer. The |
1584 buffer is created and filled with the result of a hg |
1804 HGCommand buffer variables may be useful for |
1585 command. It is executed within the context of the HG |
1805 handlers of this event (please see |
1586 command buffer. The HGCommand buffer variables may be |
1806 |hgcommand-buffer-variables|). |
1587 useful for handlers of this event (please see |
1807 |
1588 |hgcommand-buffer-variables|). |
1808 HGBufferSetup This event is fired just after HG buffer setup |
1589 |
1809 occurs, if enabled. |
1590 HGBufferSetup This event is fired just after HG buffer setup occurs, |
1810 |
1591 if enabled. |
1811 HGPluginInit This event is fired when the HGCommand plugin |
1592 |
1812 first loads. |
1593 HGPluginInit This event is fired when the HGCommand plugin first |
1813 |
1594 loads. |
1814 HGPluginFinish This event is fired just after the HGCommand |
1595 |
1815 plugin loads. |
1596 HGPluginFinish This event is fired just after the HGCommand plugin |
1816 |
1597 loads. |
1817 HGVimDiffFinish This event is fired just after the HGVimDiff |
1598 |
1818 command executes to allow customization of, |
1599 HGVimDiffFinish This event is fired just after the HGVimDiff command |
1819 for instance, window placement and focus. |
1600 executes to allow customization of, for instance, |
1820 |
1601 window placement and focus. |
1821 5.3 HGCommand buffer naming *hgcommand-naming* |
1602 |
1822 |
1603 5.3 HGCommand buffer naming *hgcommand-naming* |
1823 By default, the buffers containing the result of HG commands are nameless |
1604 |
1824 scratch buffers. It is intended that buffer variables of those buffers be |
1605 By default, the buffers containing the result of HG commands are nameless |
1825 used to customize the statusline option so that the user may fully control the |
1606 scratch buffers. It is intended that buffer variables of those buffers be |
1826 display of result buffers. |
1607 used to customize the statusline option so that the user may fully control |
1827 |
1608 the display of result buffers. |
1828 If the old-style naming is desired, please enable the |
1609 |
1829 |HGCommandNameResultBuffers| variable. Then, each result buffer will receive |
1610 If the old-style naming is desired, please enable the |
1830 a unique name that includes the source file name, the HG command, and any |
1611 |HGCommandNameResultBuffers| variable. Then, each result buffer will |
1831 extra data (such as revision numbers) that were part of the command. |
1612 receive a unique name that includes the source file name, the HG command, |
|
1613 and any extra data (such as revision numbers) that were part of the |
|
1614 command. |
1832 |
1615 |
1833 5.4 HGCommand status line support *hgcommand-statusline* |
1616 5.4 HGCommand status line support *hgcommand-statusline* |
1834 |
1617 |
1835 It is intended that the user will customize the |'statusline'| option to |
1618 It is intended that the user will customize the |'statusline'| option to |
1836 include HG result buffer attributes. A sample function that may be used in |
1619 include HG result buffer attributes. A sample function that may be used in |
1837 the |'statusline'| option is provided by the plugin, HGGetStatusLine(). In |
1620 the |'statusline'| option is provided by the plugin, HGGetStatusLine(). In |
1838 order to use that function in the status line, do something like the |
1621 order to use that function in the status line, do something like the |
1839 following: |
1622 following: > |
1840 |
1623 |
1841 set statusline=%<%f\ %{HGGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P |
1624 set statusline=%<%f\ %{HGGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P |
1842 |
1625 < |
1843 of which %{HGGetStatusLine()} is the relevant portion. |
1626 of which %{HGGetStatusLine()} is the relevant portion. |
1844 |
1627 |
1845 The sample HGGetStatusLine() function handles both HG result buffers and |
1628 The sample HGGetStatusLine() function handles both HG result buffers and |
1846 HG-managed files if HGCommand buffer management is enabled (please see |
1629 HG-managed files if HGCommand buffer management is enabled (please see |
1847 |hgcommand-buffer-management|). |
1630 |hgcommand-buffer-management|). |
1848 |
1631 |
1849 5.5 HGCommand buffer management *hgcommand-buffer-management* |
1632 5.5 HGCommand buffer management *hgcommand-buffer-management* |
1850 |
1633 |
1851 The HGCommand plugin can operate in buffer management mode, which means that |
1634 The HGCommand plugin can operate in buffer management mode, which means |
1852 it attempts to set two buffer variables ('HGRevision' and 'HGBranch') upon |
1635 that it attempts to set two buffer variables ('HGRevision' and 'HGBranch') |
1853 entry into a buffer. This is rather slow because it means that 'hg status' |
1636 upon entry into a buffer. This is rather slow because it means that 'hg |
1854 will be invoked at each entry into a buffer (during the |BufEnter| |
1637 status' will be invoked at each entry into a buffer (during the |BufEnter| |
1855 autocommand). |
1638 autocommand). |
1856 |
1639 |
1857 This mode is disabled by default. In order to enable it, set the |
1640 This mode is disabled by default. In order to enable it, set the |
1858 |HGCommandEnableBufferSetup| variable to a true (non-zero) value. Enabling |
1641 |HGCommandEnableBufferSetup| variable to a true (non-zero) value. Enabling |
1859 this mode simply provides the buffer variables mentioned above. The user must |
1642 this mode simply provides the buffer variables mentioned above. The user |
1860 explicitly include those in the |'statusline'| option if they are to appear in |
1643 must explicitly include those in the |'statusline'| option if they are to |
1861 the status line (but see |hgcommand-statusline| for a simple way to do that). |
1644 appear in the status line (but see |hgcommand-statusline| for a simple way |
|
1645 to do that). |
1862 |
1646 |
1863 ============================================================================== |
1647 ============================================================================== |
1864 |
1648 9. Tips *hgcommand-tips* |
1865 6. SSH "integration" *hgcommand-ssh* |
1649 |
1866 |
1650 9.1 Split window annotation, by Michael Anderson > |
1867 The following instructions are intended for use in integrating the |
1651 |
1868 hgcommand.vim plugin with an SSH-based HG environment. |
1652 :nmap <Leader>hgN :vs<CR><C-w>h<Leader>hgn:vertical res 40<CR> |
1869 |
|
1870 Familiarity with SSH and HG are assumed. |
|
1871 |
|
1872 These instructions assume that the intent is to have a message box pop up in |
|
1873 order to allow the user to enter a passphrase. If, instead, the user is |
|
1874 comfortable using certificate-based authentication, then only instructions |
|
1875 6.1.1 and 6.1.2 (and optionally 6.1.4) need to be followed; ssh should then |
|
1876 work transparently. |
|
1877 |
|
1878 6.1 Environment settings *hgcommand-ssh-env* |
|
1879 |
|
1880 6.1.1 HGROOT should be set to something like: |
|
1881 |
|
1882 :ext:user@host:/path_to_repository |
|
1883 |
|
1884 6.1.2 HG_RSH should be set to: |
|
1885 |
|
1886 ssh |
|
1887 |
|
1888 Together, those settings tell HG to use ssh as the transport when |
|
1889 performing HG calls. |
|
1890 |
|
1891 6.1.3 SSH_ASKPASS should be set to the password-dialog program. In my case, |
|
1892 running gnome, it's set to: |
|
1893 |
|
1894 /usr/libexec/openssh/gnome-ssh-askpass |
|
1895 |
|
1896 This tells SSH how to get passwords if no input is available. |
|
1897 |
|
1898 6.1.4 OPTIONAL. You may need to set SSH_SERVER to the location of the hg |
|
1899 executable on the remote (server) machine. |
|
1900 |
|
1901 6.2 HG wrapper program *hgcommand-ssh-wrapper* |
|
1902 |
|
1903 Now you need to convince SSH to use the password-dialog program. This means |
|
1904 you need to execute SSH (and therefore HG) without standard input. The |
|
1905 following script is a simple perl wrapper that dissasociates the HG command |
|
1906 from the current terminal. Specific steps to do this may vary from system to |
|
1907 system; the following example works for me on linux. |
|
1908 |
|
1909 #!/usr/bin/perl -w |
|
1910 use strict; |
|
1911 use POSIX qw(setsid); |
|
1912 open STDIN, '/dev/null'; |
|
1913 fork and do {wait; exit;}; |
|
1914 setsid; |
|
1915 exec('hg', @ARGV); |
|
1916 |
|
1917 6.3 Configuring hgcommand.vim *hgcommand-ssh-config* |
|
1918 |
|
1919 At this point, you should be able to use your wrapper script to invoke HG with |
|
1920 various commands, and get the password dialog. All that's left is to make HG |
|
1921 use your newly-created wrapper script. |
|
1922 |
|
1923 6.3.1 Tell hgcommand.vim what HG executable to use. The easiest way to do this |
|
1924 is globally, by putting the following in your .vimrc: |
|
1925 |
|
1926 let HGCommandHGExec=/path/to/hg/wrapper/script |
|
1927 |
|
1928 6.4 Where to go from here *hgcommand-ssh-other* |
|
1929 |
|
1930 The script given above works even when non-SSH HG connections are used, |
|
1931 except possibly when interactively entering the message for HG commit log |
|
1932 (depending on the editor you use... VIM works fine). Since the hgcommand.vim |
|
1933 plugin handles that message without a terminal, the wrapper script can be used |
|
1934 all the time. |
|
1935 |
|
1936 This allows mixed-mode operation, where some work is done with SSH-based HG |
|
1937 repositories, and others with pserver or local access. |
|
1938 |
|
1939 It is possible, though beyond the scope of the plugin, to dynamically set the |
|
1940 HG executable based on the HGROOT for the file being edited. The user |
|
1941 events provided (such as HGBufferCreated and HGBufferSetup) can be used to |
|
1942 set a buffer-local value (b:HGCommandHGExec) to override the HG executable |
|
1943 on a file-by-file basis. Alternatively, much the same can be done (less |
|
1944 automatically) by the various project-oriented plugins out there. |
|
1945 |
|
1946 It is highly recommended for ease-of-use that certificates with no passphrase |
|
1947 or ssh-agent are employed so that the user is not given the password prompt |
|
1948 too often. |
|
1949 |
|
1950 ============================================================================== |
|
1951 9. Tips *hgcommand-tips* |
|
1952 |
|
1953 9.1 Split window annotation, by Michael Anderson |
|
1954 |
|
1955 :nmap <Leader>hgN :vs<CR><C-w>h<Leader>hgn:vertical res 40<CR> |
|
1956 \ggdddd:set scb<CR>:set nowrap<CR><C-w>lgg:set scb<CR> |
1653 \ggdddd:set scb<CR>:set nowrap<CR><C-w>lgg:set scb<CR> |
1957 \:set nowrap<CR> |
1654 \:set nowrap<CR> |
1958 |
1655 < |
1959 This splits the buffer vertically, puts an annotation on the left (minus the |
1656 |
1960 header) with the width set to 40. An editable/normal copy is placed on the |
1657 This splits the buffer vertically, puts an annotation on the left (minus |
1961 right. The two versions are scroll locked so they move as one. and wrapping |
1658 the header) with the width set to 40. An editable/normal copy is placed on |
1962 is turned off so that the lines line up correctly. The advantages are... |
1659 the right. The two versions are scroll locked so they move as one. and |
1963 |
1660 wrapping is turned off so that the lines line up correctly. The advantages |
1964 1) You get a versioning on the right. |
1661 are... |
1965 2) You can still edit your own code. |
1662 |
1966 3) Your own code still has syntax highlighting. |
1663 1) You get a versioning on the right. |
|
1664 2) You can still edit your own code. |
|
1665 3) Your own code still has syntax highlighting. |
1967 |
1666 |
1968 ============================================================================== |
1667 ============================================================================== |
1969 |
1668 |
1970 8. Known bugs *hgcommand-bugs* |
1669 8. Known bugs *hgcommand-bugs* |
1971 |
1670 |
1972 Please let me know if you run across any. |
1671 Please let me know if you run across any. |
1973 |
1672 |
1974 HGVimDiff, when using the original (real) source buffer as one of the diff |
1673 HGVimDiff, when using the original (real) source buffer as one of the diff |
1975 buffers, uses some hacks to try to restore the state of the original buffer |
1674 buffers, uses some hacks to try to restore the state of the original buffer |
1976 when the scratch buffer containing the other version is destroyed. There may |
1675 when the scratch buffer containing the other version is destroyed. There |
1977 still be bugs in here, depending on many configuration details. |
1676 may still be bugs in here, depending on many configuration details. |
1978 |
1677 |
1979 ============================================================================== |
1678 ============================================================================== |
1980 === END_DOC |
1679 === END_DOC |
1981 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
1680 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
1982 " v im:tw=78:ts=8:ft=help:norl: |
1681 " v im:tw=78:ts=8:ft=help:norl: |