vcshg: Identify hg version control when not in the root of a repository.
[vcscommand.git] / doc / vcscommand.txt
blob34fb5ccb2a9a8c614413bc9dfab2ff2e1ec3b868
1 *vcscommand.txt*        vcscommand
2 Copyright (c) 2007 Bob Hiestand
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to
6 deal in the Software without restriction, including without limitation the
7 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 sell copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 IN THE SOFTWARE.
22 For instructions on installing this file, type
23         :help add-local-help
24 inside Vim.
26 Author:  Bob Hiestand <bob.hiestand@gmail.com>
27 Credits:  Benji Fisher's excellent MatchIt documentation
29 ==============================================================================
30 1. Contents                                             *vcscommand-contents*
32         Installation            : |vcscommand-install|
33         vcscommand Intro        : |vcscommand|
34         vcscommand Manual       : |vcscommand-manual|
35         Customization           : |vcscommand-customize|
36         SSH "integration"       : |vcscommand-ssh|
37         Changes from cvscommand : |cvscommand-changes|
38         Bugs                    : |vcscommand-bugs|
40 ==============================================================================
42 2. vcscommand Installation                              *vcscommand-install*
44 The vcscommand plugin comprises five files: vcscommand.vim, vcssvn.vim,
45 vcscvs.vim, vcssvk.vim and vcscommand.txt (this file).  In order to install
46 the plugin, place the vcscommand.vim, vcssvn.vim, vcssvk.vim, and vcscvs.vim
47 files into a plugin directory in your runtime path (please see
48 |add-global-plugin| and |'runtimepath'|. 
50 This help file can be included in the VIM help system by copying it into a
51 'doc' directory in your runtime path and then executing the |:helptags|
52 command, specifying the full path of the 'doc' directory.  Please see
53 |add-local-help| for more details.
55 vcscommand may be customized by setting variables, creating maps, and
56 specifying event handlers.  Please see |vcscommand-customize| for more
57 details.
59 ==============================================================================
61 3. vcscommand Intro                                     *vcscommand*
62                                                         *vcscommand-intro*
64 The vcscommand plugin provides global ex commands for manipulating
65 version-controlled source files, currently those controlled either by CVS or
66 Subversion.  In general, each command operates on the current buffer and
67 accomplishes a separate source control function, such as update, commit, log,
68 and others (please see |vcscommand-commands| for a list of all available
69 commands).  The results of each operation are displayed in a scratch buffer.
70 Several buffer variables are defined for those scratch buffers (please see
71 |vcscommand-buffer-variables|).
73 The notion of "current file" means either the current buffer, or, in the case
74 of a directory buffer (such as Explorer or netrw buffers), the directory (and
75 all subdirectories) represented by the the buffer.
77 For convenience, any vcscommand invoked on a vcscommand scratch buffer acts as
78 though it was invoked on the original file and splits the screen so that the
79 output appears in a new window.
81 Many of the commands accept revisions as arguments.  By default, most operate
82 on the most recent revision on the current branch if no revision is specified.
84 Each vcscommand is mapped to a key sequence starting with the |<Leader>|
85 keystroke.  The default mappings may be overridden by supplying different
86 mappings before the plugin is loaded, such as in the vimrc, in the standard
87 fashion for plugin mappings.  For examples, please see
88 |vcscommand-mappings-override|.
90 The vcscommand plugin may be configured in several ways.  For more details,
91 please see |vcscommand-customize|.
93 ==============================================================================
95 4. vcscommand Manual                                    *vcscommand-manual*
97 4.1 vcscommand commands                                 *vcscommand-commands*
99 vcscommand defines the following commands:
101 |:VCSAdd|
102 |:VCSAnnotate|
103 |:VCSBlame|
104 |:VCSCommit|
105 |:VCSDelete|
106 |:VCSDiff|
107 |:VCSGotoOriginal|
108 |:VCSLog|
109 |:VCSRemove|
110 |:VCSRevert|
111 |:VCSReview|
112 |:VCSStatus|
113 |:VCSUpdate|
114 |:VCSVimDiff|
116 The following commands are specific to CVS files:
118 |:CVSEdit|
119 |:CVSEditors|
120 |:CVSUnedit|
121 |:CVSWatch|
122 |:CVSWatchAdd|
123 |:CVSWatchOn|
124 |:CVSWatchOff|
125 |:CVSWatchRemove|
126 |:CVSWatchers|
128 :VCSAdd                                                 *:VCSAdd*
130 This command adds the current file to source control.  Please note, this does
131 not commit the newly-added file.  All parameters to the command are passed to
132 the underlying VCS.
134 :VCSAnnotate[!]                                         *:VCSAnnotate*
136 This command displays the current file with each line annotated with the
137 version in which it was most recently changed.  If an argument is given, the
138 argument is used as a revision number to display.  If not given an argument,
139 it uses the most recent version of the file (on the current branch, if under
140 CVS control).  Additionally, if the current buffer is a VCSAnnotate buffer
141 already, the version number on the current line is used.
143 If '!' is used, the view of the annotated buffer is split so that the
144 annotation is in a separate window from the content, and each is highlighted
145 separately.
147 For CVS buffers, the 'VCSCommandCVSAnnotateParent' option, if set to non-zero,
148 will cause the above behavior to change.  Instead of annotating the version on
149 the current line, the parent revision is used instead, crossing branches if
150 necessary.
152 The filetype of the vcscommand scratch buffer is set to one of 'CVSAnnotate',
153 'SVNAnnotate', 'SVKAnnotate' or 'gitAnnotate' as appropriate, to take advantage of the
154 bundled syntax files.
156 :VCSBlame[!]                                            *:VCSBlame*
158 Alias for |:VCSAnnotate|.
160 :VCSCommit[!]                                           *:VCSCommit*
162 This command commits changes to the current file to source control.
164 If called with arguments, the arguments are the log message.
166 If '!' is used, an empty log message is committed.
168 If called with no arguments, this is a two-step command.  The first step opens
169 a buffer to accept a log message.  When that buffer is written, it is
170 automatically closed and the file is committed using the information from that
171 log message.  The commit can be abandoned if the log message buffer is deleted
172 or wiped before being written.
174 Alternatively, the mapping that is used to invoke :VCSCommit (by default
175 |<Leader>|cc, please see |vcscommand-mappings|) can be used in the log message
176 buffer in Normal mode to immediately commit.  This is useful if the
177 |VCSCommandCommitOnWrite| variable is set to 0 to disable the normal
178 commit-on-write behavior.
180 :VCSDelete                                              *:VCSDelete*
182 Deletes the current file and removes it from source control.  All parameters
183 to the command are passed to the underlying VCS.
185 :VCSDiff                                                *:VCSDiff*
187 With no arguments, this displays the differences between the current file and
188 its parent version under source control in a new scratch buffer.
190 With one argument, the diff is performed on the current file against the
191 specified revision.
193 With two arguments, the diff is performed between the specified revisions of
194 the current file.
196 For CVS, this command uses the |VCSCommandCVSDiffOpt| variable to specify diff
197 options.  If that variable does not exist, a plugin-specific default is used.
198 If you wish to have no options, then set it to the empty string.
200 For SVN, this command uses the |VCSCommandSVNDiffOpt| variable to specify diff
201 options.  If that variable does not exist, the SVN default is used.
202 Additionally, |VCSCommandSVNDiffExt| can be used to select an external diff
203 application.
205 :VCSGotoOriginal                                        *:VCSGotoOriginal*
207 This command jumps to the source buffer if the current buffer is a VCS scratch
208 buffer.
210 :VCSGotoOriginal!
212 Like ":VCSGotoOriginal" but also executes :bufwipeout on all VCS scrach
213 buffers associated with the original file.
215 :VCSInfo                                                *:VCSInfo*
217 This command displays extended information about the current file in a new
218 scratch buffer. 
220 :VCSLock                                                *:VCSLock*
222 This command locks the current file in order to prevent other users from
223 concurrently modifying it.  The exact semantics of this command depend on the
224 underlying VCS.  This does nothing in CVS.  All parameters are passed to the
225 underlying VCS.
227 :VCSLog                                                 *:VCSLog*
229 Displays the version history of the current file in a new scratch buffer.  If
230 there is one parameter supplied, it is taken as as a revision parameters to be
231 passed through to the underlying VCS.  Otherwise, all parameters are passed to
232 the underlying VCS.
234 :VCSRemove                                              *:VCSRemove*
236 Alias for |:VCSDelete|.
238 :VCSRevert                                              *:VCSRevert*
240 This command replaces the current file with the most recent version from the
241 repository in order to wipe out any undesired changes.
243 :VCSReview                                              *:VCSReview*
245 Displays a particular version of the current file in a new scratch buffer.  If
246 no argument is given, the most recent version of the file on the current
247 branch is retrieved.
249 :VCSStatus                                              *:VCSStatus*
251 Displays versioning information about the current file in a new scratch
252 buffer.  All parameters are passed to the underlying VCS.
255 :VCSUnlock                                              *:VCSUnlock*
257 Unlocks the current file in order to allow other users from concurrently
258 modifying it.  The exact semantics of this command depend on the underlying
259 VCS.  All parameters are passed to the underlying VCS.
261 :VCSUpdate                                              *:VCSUpdate*
263 Updates the current file with any relevant changes from the repository.  This
264 intentionally does not automatically reload the current buffer, though vim
265 should prompt the user to do so if the underlying file is altered by this
266 command.
268 :VCSVimDiff                                             *:VCSVimDiff*
270 Uses vimdiff to display differences between versions of the current file.
272 If no revision is specified, the most recent version of the file on the
273 current branch is used.  With one argument, that argument is used as the
274 revision as above.  With two arguments, the differences between the two
275 revisions is displayed using vimdiff.
276                                                             
277 With either zero or one argument, the original buffer is used to perform the
278 vimdiff.  When the scratch buffer is closed, the original buffer will be
279 returned to normal mode.
280                                                             
281 Once vimdiff mode is started using the above methods, additional vimdiff
282 buffers may be added by passing a single version argument to the command.
283 There may be up to 4 vimdiff buffers total.
284                                                             
285 Using the 2-argument form of the command resets the vimdiff to only those 2
286 versions.  Additionally, invoking the command on a different file will close
287 the previous vimdiff buffers.
289 :CVSEdit                                                *:CVSEdit*
291 This command performs "cvs edit" on the current file.  Yes, the output buffer
292 in this case is almost completely useless.
294 :CVSEditors                                             *:CVSEditors*
296 This command performs "cvs edit" on the current file.
298 :CVSUnedit                                              *:CVSUnedit*
300 Performs "cvs unedit" on the current file.  Again, yes, the output buffer here
301 is basically useless.
303 :CVSWatch                                               *:CVSWatch*
305 This command takes an argument which must be one of [on|off|add|remove].  The
306 command performs "cvs watch" with the given argument on the current file.
308 :CVSWatchAdd                                            *:CVSWatchAdd*
310 This command is an alias for ":CVSWatch add"
312 :CVSWatchOn                                             *:CVSWatchOn*
314 This command is an alias for ":CVSWatch on"
316 :CVSWatchOff                                            *:CVSWatchOff*
318 This command is an alias for ":CVSWatch off"
320 :CVSWatchRemove                                         *:CVSWatchRemove*
322 This command is an alias for ":CVSWatch remove"
324 :CVSWatchers                                            *:CVSWatchers*
326 This command performs "cvs watchers" on the current file.
328 4.2 Mappings                                            *vcscommand-mappings*
330 By default, a mapping is defined for each command.  These mappings execute the
331 default (no-argument) form of each command.
333 |<Leader>|ca VCSAdd
334 |<Leader>|cn VCSAnnotate
335 |<Leader>|cN VCSAnnotate!
336 |<Leader>|cc VCSCommit
337 |<Leader>|cD VCSDelete
338 |<Leader>|cd VCSDiff
339 |<Leader>|cg VCSGotoOriginal
340 |<Leader>|cG VCSGotoOriginal!
341 |<Leader>|ci VCSInfo
342 |<Leader>|cl VCSLog
343 |<Leader>|cL VCSLock
344 |<Leader>|cr VCSReview
345 |<Leader>|cs VCSStatus
346 |<Leader>|cu VCSUpdate
347 |<Leader>|cU VCSUnlock
348 |<Leader>|cv VCSVimDiff
350 Only for CVS buffers:
352 |<Leader>|ce CVSEdit
353 |<Leader>|cE CVSEditors
354 |<Leader>|ct CVSUnedit
355 |<Leader>|cwv CVSWatchers
356 |<Leader>|cwa CVSWatchAdd
357 |<Leader>|cwn CVSWatchOn
358 |<Leader>|cwf CVSWatchOff
359 |<Leader>|cwf CVSWatchRemove
361                                                 *vcscommand-mappings-override*
363 The default mappings can be overridden by user-provided instead by mapping to
364 <Plug>CommandName.  This is especially useful when these mappings collide with
365 other existing mappings (vim will warn of this during plugin initialization,
366 but will not clobber the existing mappings).
368 There are three methods for controlling mapping:
370 First, maps can be overriden for individual commands.  For instance, to
371 override the default mapping for :VCSAdd to set it to '\add', add the
372 following to the vimrc:
374 nmap \add <Plug>VCSAdd
376 Second, the default map prefix ('<Leader>c') can be overridden by defining the
377 |VCSCommandMapPrefix| variable.
379 Third, the entire set of default maps can be overridden by defining the
380 |VCSCommandMappings| variable.
383 4.3 Automatic buffer variables                  *vcscommand-buffer-variables*
385 Several buffer variables are defined in each vcscommand result buffer.  These
386 may be useful for additional customization in callbacks defined in the event
387 handlers (please see |vcscommand-events|).
389 The following variables are automatically defined:
391 b:VCSCommandOriginalBuffer                      *b:VCSCommandOriginalBuffer*
393 This variable is set to the buffer number of the source file.
395 b:VCSCommandCommand                             *b:VCSCommandCommand*
397 This variable is set to the name of the vcscommand that created the result
398 buffer.
400 b:VCSCommandSourceFile                          *b:VCSCommandSourceFile*
402 This variable is set to the name of the original file under source control.
404 b:VCSCommandVCSType                             *b:VCSCommandVCSType*
406 This variable is set to the type of the source control.  This variable is also
407 set on the original file itself.
408 ==============================================================================
410 5. Configuration and customization                      *vcscommand-customize*
411                                                         *vcscommand-config*
413 The vcscommand plugin can be configured in several ways:  by setting
414 configuration variables (see |vcscommand-options|) or by defining vcscommand
415 event handlers (see |vcscommand-events|).  Additionally, the vcscommand plugin
416 supports a customized status line (see |vcscommand-statusline| and
417 |vcscommand-buffer-management|).
419 5.1 vcscommand configuration variables                  *vcscommand-options*
421 Several variables affect the plugin's behavior.  These variables are checked
422 at time of execution, and may be defined at the window, buffer, or global
423 level and are checked in that order of precedence.
426 The following variables are available:
428 |VCSCommandCommitOnWrite|
429 |VCSCommandCVSDiffOpt|
430 |VCSCommandCVSExec|
431 |VCSCommandDeleteOnHide|
432 |VCSCommandDiffSplit|
433 |VCSCommandDisableAll|
434 |VCSCommandDisableMappings|
435 |VCSCommandDisableExtensionMappings|
436 |VCSCommandEdit|
437 |VCSCommandEnableBufferSetup|
438 |VCSCommandMappings|
439 |VCSCommandMapPrefix|
440 |VCSCommandResultBufferNameExtension|
441 |VCSCommandResultBufferNameFunction|
442 |VCSCommandSplit|
443 |VCSCommandSVKExec|
444 |VCSCommandSVNDiffExt|
445 |VCSCommandSVNDiffOpt|
446 |VCSCommandSVNExec|
447 |VCSCommandVCSTypeOverride|
449 VCSCommandCommitOnWrite                         *VCSCommandCommitOnWrite*
451 This variable, if set to a non-zero value, causes the pending commit
452 to take place immediately as soon as the log message buffer is written.
453 If set to zero, only the VCSCommit mapping will cause the pending commit to
454 occur.  If not set, it defaults to 1.
456 VCSCommandCVSExec                               *VCSCommandCVSExec*
458 This variable controls the executable used for all CVS commands  If not set,
459 it defaults to "cvs".
461 VCSCommandDeleteOnHide                          *VCSCommandDeleteOnHide*
463 This variable, if set to a non-zero value, causes the temporary result buffers
464 to automatically delete themselves when hidden.
466 VCSCommandCVSDiffOpt                            *VCSCommandCVSDiffOpt*
468 This variable, if set, determines the options passed to the diff command of
469 CVS.  If not set, it defaults to 'u'.
471 VCSCommandDiffSplit                             *VCSCommandDiffSplit*
473 This variable overrides the |VCSCommandSplit| variable, but only for buffers
474 created with |:VCSVimDiff|.
476 VCSCommandDisableAll                            *VCSCommandDisableAll*
478 This variable, if set, prevents the plugin or any extensions from loading at
479 all.  This is useful when a single runtime distribution is used on multiple
480 systems with varying versions.
482 VCSCommandDisableMappings                       *VCSCommandDisableMappings*
484 This variable, if set to a non-zero value, prevents the default command
485 mappings from being set.  This supercedes 
486 |VCSCommandDisableExtensionMappings|.
488 VCSCommandDisableExtensionMappings      *VCSCommandDisableExtensionMappings*
490 This variable, if set to a non-zero value, prevents the default command
491 mappings from being set for commands specific to an individual VCS.
493 VCSCommandEdit                                  *VCSCommandEdit*
495 This variable controls whether the original buffer is replaced ('edit') or
496 split ('split').  If not set, it defaults to 'split'.
498 VCSCommandEnableBufferSetup                     *VCSCommandEnableBufferSetup*
500 This variable, if set to a non-zero value, activates VCS buffer management
501 mode see (|vcscommand-buffer-management|).  This mode means that the
502 'VCSCommandBufferInfo' variable is filled with version information if the file
503 is VCS-controlled.  This is useful for displaying version information in the
504 status bar.
506 VCSCommandMappings                              *VCSCommandMappings*
508 This variable, if set, overrides the default mappings used for shortcuts.  It
509 should be a List of 2-element Lists, each containing a shortcut and function
510 name pair.  The value of the '|VCSCommandMapPrefix|' variable will be added to
511 each shortcut.
513 VCSCommandMapPrefix                             *VCSCommandMapPrefix*
515 This variable, if set, overrides the default mapping prefix ('<Leader>c').
516 This allows customization of the mapping space used by the vcscommand
517 shortcuts.
519 VCSCommandResultBufferNameExtension     *VCSCommandResultBufferNameExtension*
521 This variable, if set to a non-blank value, is appended to the name of the VCS
522 command output buffers.  For example, '.vcs'.  Using this option may help
523 avoid problems caused by autocommands dependent on file extension.
525 VCSCommandResultBufferNameFunction      *VCSCommandResultBufferNameFunction*
527 This variable, if set, specifies a custom function for naming VCS command
528 output buffers.  This function is expected to return the new buffer name, and
529 will be passed the following arguments:
531   command - name of the VCS command being executed (such as 'Log' or
532   'Diff').
533   
534   originalBuffer - buffer number of the source file.
535   
536   vcsType - type of VCS controlling this file (such as 'CVS' or 'SVN').
537   
538   statusText - extra text associated with the VCS action (such as version
539   numbers).
541 VCSCommandSplit                                 *VCSCommandSplit*
543 This variable controls the orientation of the various window splits that
544 may occur.
546 If set to 'horizontal', the resulting windows will be on stacked on top of
547 one another.  If set to 'vertical', the resulting windows will be
548 side-by-side.  If not set, it defaults to 'horizontal' for all but
549 VCSVimDiff windows.  VCSVimDiff windows default to the user's 'diffopt'
550 setting, if set, otherwise 'vertical'.
552 VCSCommandSVKExec                               *VCSCommandSVKExec*
554 This variable controls the executable used for all SVK commands  If not set,
555 it defaults to "svk".
557 VCSCommandSVNDiffExt                            *VCSCommandSVNDiffExt*
559 This variable, if set, is passed to SVN via the --diff-cmd command to select
560 an external application for performing the diff.
562 VCSCommandSVNDiffOpt                            *VCSCommandSVNDiffOpt*
564 This variable, if set, determines the options passed with the '-x' parameter
565 to the SVN diff command.  If not set, no options are passed.
567 VCSCommandSVNExec                               *VCSCommandSVNExec*
569 This variable controls the executable used for all SVN commands  If not set,
570 it defaults to "svn".
572 VCSCommandVCSTypeOverride                       *VCSCommandVCSTypeOverride*
574 This variable allows the VCS type detection to be overridden on a path-by-path
575 basis.  The value of this variable is expected to be a List of Lists.  Each
576 item in the high-level List is a List containing two elements.  The first
577 element is a regular expression that will be matched against the full file
578 name of a given buffer.  If it matches, the second element will be used as the
579 VCS type.
581 5.2 VCSCommand events                           *vcscommand-events*
583 For additional customization, vcscommand can trigger user-defined events.
584 Event handlers are provided by defining User event autocommands (see
585 |autocommand|, |User|) in the vcscommand group with patterns matching the
586 event name.
588 For instance, the following could be added to the vimrc to provide a 'q'
589 mapping to quit a vcscommand scratch buffer:
591 augroup VCSCommand
592   au User VCSBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr>
593 augroup END
595 The following hooks are available:
597 VCSBufferCreated                This event is fired just after a vcscommand
598                                 result buffer is created and populated.  It is
599                                 executed within the context of the vcscommand
600                                 buffer.  The vcscommand buffer variables may
601                                 be useful for handlers of this event (please
602                                 see |vcscommand-buffer-variables|).
604 VCSBufferSetup                  This event is fired just after vcscommand buffer
605                                 setup occurs, if enabled.
607 VCSPluginInit                   This event is fired when the vcscommand plugin
608                                 first loads.
610 VCSPluginFinish                 This event is fired just after the vcscommand
611                                 plugin loads.
613 VCSVimDiffFinish                This event is fired just after the VCSVimDiff
614                                 command executes to allow customization of,
615                                 for instance, window placement and focus.
617 Additionally, there is another hook which is used internally to handle loading
618 the multiple scripts in order.  This hook should probably not be used by an
619 end user without a good idea of how it works.  Among other things, any events
620 associated with this hook are cleared after they are executed (during
621 vcscommand.vim script initialization).
623 VCSLoadExtensions               This event is fired just before the
624                                 VCSPluginFinish.  It is used internally to
625                                 execute any commands from the VCS
626                                 implementation plugins that needs to be
627                                 deferred until the primary plugin is
628                                 initialized.
630 5.3 vcscommand buffer naming                            *vcscommand-naming*
632 vcscommand result buffers use the following naming convention:
633 [{VCS type} {VCS command} {Source file name}]
635 If additional buffers are created that would otherwise conflict, a
636 distinguishing number is added:
638 [{VCS type} {VCS command} {Source file name}] (1,2, etc)
640 5.4 vcscommand status line support                      *vcscommand-statusline*
642 It is intended that the user will customize the |'statusline'| option to
643 include vcscommand result buffer attributes.  A sample function that may be
644 used in the |'statusline'| option is provided by the plugin,
645 VCSCommandGetStatusLine().  In order to use that function in the status line, do
646 something like the following:
648 set statusline=%<%f\ %{VCSCommandGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P
650 of which %{VCSCommandGetStatusLine()} is the relevant portion.
652 The sample VCSCommandGetStatusLine() function handles both vcscommand result
653 buffers and VCS-managed files if vcscommand buffer management is enabled
654 (please see |vcscommand-buffer-management|).
656 5.5 vcscommand buffer management                *vcscommand-buffer-management*
658 The vcscommand plugin can operate in buffer management mode, which means that
659 it attempts to set a buffer variable ('VCSCommandBufferInfo') upon entry into
660 a buffer.  This is rather slow because it means that the VCS will be invoked
661 at each entry into a buffer (during the |BufEnter| autocommand).
663 This mode is disabled by default.  In order to enable it, set the
664 |VCSCommandEnableBufferSetup| variable to a true (non-zero) value.  Enabling
665 this mode simply provides the buffer variable mentioned above.  The user must
666 explicitly include information from the variable in the |'statusline'| option
667 if they are to appear in the status line (but see |vcscommand-statusline| for
668 a simple way to do that).
670 The 'VCSCommandBufferInfo' variable is a list which contains, in order, the
671 revision of the current file, the latest revision of the file in the
672 repository, and (for CVS) the name of the branch.  If those values cannot be
673 determined, the list is a single element:  'Unknown'.
675 ==============================================================================
677 6. SSH "integration"                                    *vcscommand-ssh*
679 The following instructions are intended for use in integrating the
680 vcscommand.vim plugin with an SSH-based CVS environment.
682 Familiarity with SSH and CVS are assumed.
684 These instructions assume that the intent is to have a message box pop up in
685 order to allow the user to enter a passphrase.  If, instead, the user is
686 comfortable using certificate-based authentication, then only instructions
687 6.1.1 and 6.1.2 (and optionally 6.1.4) need to be followed; ssh should then
688 work transparently.
690 6.1 Environment settings                                *vcscommand-ssh-env*
692 6.1.1 CVSROOT should be set to something like:
694         :ext:user@host:/path_to_repository
696 6.1.2 CVS_RSH should be set to:
698         ssh
700         Together, those settings tell CVS to use ssh as the transport when
701         performing CVS calls.
703 6.1.3 SSH_ASKPASS should be set to the password-dialog program.  In my case,
704         running gnome, it's set to:
706         /usr/libexec/openssh/gnome-ssh-askpass
708         This tells SSH how to get passwords if no input is available.
710 6.1.4 OPTIONAL.  You may need to set SSH_SERVER to the location of the cvs
711         executable on the remote (server) machine.
713 6.2 CVS wrapper program                         *vcscommand-ssh-wrapper*
715 Now you need to convince SSH to use the password-dialog program.  This means
716 you need to execute SSH (and therefore CVS) without standard input.  The
717 following script is a simple perl wrapper that dissasociates the CVS command
718 from the current terminal.  Specific steps to do this may vary from system to
719 system; the following example works for me on linux.
721 #!/usr/bin/perl -w
722 use strict;
723 use POSIX qw(setsid);
724 open STDIN, '/dev/null';
725 fork and do {wait; exit;};
726 setsid;
727 exec('cvs', @ARGV);
729 6.3 Configuring vcscommand.vim                  *vcscommand-ssh-config*
731 At this point, you should be able to use your wrapper script to invoke CVS with
732 various commands, and get the password dialog.  All that's left is to make CVS
733 use your newly-created wrapper script.
735 6.3.1 Tell vcscommand.vim what CVS executable to use.  The easiest way to do this
736         is globally, by putting the following in your .vimrc:
738         let VCSCommandCVSExec=/path/to/cvs/wrapper/script
740 6.4 Where to go from here                       *vcscommand-ssh-other*
742 The script given above works even when non-SSH CVS connections are used,
743 except possibly when interactively entering the message for CVS commit log
744 (depending on the editor you use... VIM works fine).  Since the vcscommand.vim
745 plugin handles that message without a terminal, the wrapper script can be used
746 all the time.
748 This allows mixed-mode operation, where some work is done with SSH-based CVS
749 repositories, and others with pserver or local access.
751 It is possible, though beyond the scope of the plugin, to dynamically set the
752 CVS executable based on the CVSROOT for the file being edited.  The user
753 events provided (such as VCSBufferCreated and VCSBufferSetup) can be used to
754 set a buffer-local value (b:VCSCommandCVSExec) to override the CVS executable
755 on a file-by-file basis.  Alternatively, much the same can be done (less
756 automatically) by the various project-oriented plugins out there.
758 It is highly recommended for ease-of-use that certificates with no passphrase
759 or ssh-agent are employed so that the user is not given the password prompt
760 too often.
762 ==============================================================================
764 7. Changes from cvscommand                              *cvscommand-changes*
766 1.  Require Vim 7 in order to leverage several convenient features; also
767 because I wanted to play with Vim 7.
769 2.  Renamed commands to start with 'VCS' instead of 'CVS'.  The exceptions are
770 the 'CVSEdit' and 'CVSWatch' family of commands, which are specific to CVS.
772 3.  Renamed options, events to start with 'VCSCommand'.
774 4.  Removed option to jump to the parent version of the current line in an
775 annotated buffer, as opposed to the version on the current line.  This made
776 little sense in the branching scheme used by subversion, where jumping to a
777 parent branch required finding a different location in the repository.  It
778 didn't work consistently in CVS anyway.
780 5.  Removed option to have nameless scratch buffers.
782 6.  Changed default behavior of scratch buffers to split the window instead of
783 displaying in the current window.  This may still be overridden using the
784 'VCSCommandEdit' option.
786 7.  Split plugin into multiple plugins.
788 8.  Added 'VCSLock' and 'VCSUnlock' commands.  These are implemented for
789 subversion but not for CVS.  These were not kept specific to subversion as they
790 seemed more general in nature and more likely to be supported by any future VCS
791 supported by this plugin.
793 9.  Changed name of buffer variables set by commands.
795 'b:cvsOrigBuffNR' became 'b:VCSCommandOriginalBuffer'
796 'b:cvscmd' became 'b:VCSCommandCommand'
798 10.  Added new automatic variables to command result buffers.
800 'b:VCSCommandSourceFile'
801 'b:VCSCommandVCSType'
803 ==============================================================================
805 8. Known bugs                                           *vcscommand-bugs*
807 Please let me know if you run across any.
809 CVSUnedit may, if a file is changed from the repository, provide prompt text
810 to determine whether the changes should be thrown away.  Currently, that text
811 shows up in the CVS result buffer as information; there is no way for the user
812 to actually respond to the prompt and the CVS unedit command does nothing.  If
813 this really bothers anyone, please let me know.
815 VCSVimDiff, when using the original (real) source buffer as one of the diff
816 buffers, uses some hacks to try to restore the state of the original buffer
817 when the scratch buffer containing the other version is destroyed.  There may
818 still be bugs in here, depending on many configuration details.
820 vim:tw=78:ts=8:ft=help