VCSAnnotate: jump to current line.
[vcscommand.git] / doc / vcscommand.txt
blob28d4e63433e303e2efcec1496c97a2725a88ecf2
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 With no arguments the cursor will jump to the line in the annotated buffer
153 corresponding to the current line in the source buffer.
155 :VCSBlame[!]                                            *:VCSBlame*
157 Alias for |:VCSAnnotate|.
159 :VCSCommit[!]                                           *:VCSCommit*
161 This command commits changes to the current file to source control.
163 If called with arguments, the arguments are the log message.
165 If '!' is used, an empty log message is committed.
167 If called with no arguments, this is a two-step command.  The first step opens
168 a buffer to accept a log message.  When that buffer is written, it is
169 automatically closed and the file is committed using the information from that
170 log message.  The commit can be abandoned if the log message buffer is deleted
171 or wiped before being written.
173 Alternatively, the mapping that is used to invoke :VCSCommit (by default
174 |<Leader>|cc, please see |vcscommand-mappings|) can be used in the log message
175 buffer in Normal mode to immediately commit.  This is useful if the
176 |VCSCommandCommitOnWrite| variable is set to 0 to disable the normal
177 commit-on-write behavior.
179 :VCSDelete                                              *:VCSDelete*
181 Deletes the current file and removes it from source control.  All parameters
182 to the command are passed to the underlying VCS.
184 :VCSDiff                                                *:VCSDiff*
186 With no arguments, this displays the differences between the current file and
187 its parent version under source control in a new scratch buffer.
189 With one argument, the diff is performed on the current file against the
190 specified revision.
192 With two arguments, the diff is performed between the specified revisions of
193 the current file.
195 For CVS, this command uses the |VCSCommandCVSDiffOpt| variable to specify diff
196 options.  If that variable does not exist, a plugin-specific default is used.
197 If you wish to have no options, then set it to the empty string.
199 For SVN, this command uses the |VCSCommandSVNDiffOpt| variable to specify diff
200 options.  If that variable does not exist, the SVN default is used.
201 Additionally, |VCSCommandSVNDiffExt| can be used to select an external diff
202 application.
204 :VCSGotoOriginal                                        *:VCSGotoOriginal*
206 This command jumps to the source buffer if the current buffer is a VCS scratch
207 buffer.
209 :VCSGotoOriginal!
211 Like ":VCSGotoOriginal" but also executes :bufwipeout on all VCS scrach
212 buffers associated with the original file.
214 :VCSInfo                                                *:VCSInfo*
216 This command displays extended information about the current file in a new
217 scratch buffer. 
219 :VCSLock                                                *:VCSLock*
221 This command locks the current file in order to prevent other users from
222 concurrently modifying it.  The exact semantics of this command depend on the
223 underlying VCS.  This does nothing in CVS.  All parameters are passed to the
224 underlying VCS.
226 :VCSLog                                                 *:VCSLog*
228 Displays the version history of the current file in a new scratch buffer.  If
229 there is one parameter supplied, it is taken as as a revision parameters to be
230 passed through to the underlying VCS.  Otherwise, all parameters are passed to
231 the underlying VCS.
233 :VCSRemove                                              *:VCSRemove*
235 Alias for |:VCSDelete|.
237 :VCSRevert                                              *:VCSRevert*
239 This command replaces the current file with the most recent version from the
240 repository in order to wipe out any undesired changes.
242 :VCSReview                                              *:VCSReview*
244 Displays a particular version of the current file in a new scratch buffer.  If
245 no argument is given, the most recent version of the file on the current
246 branch is retrieved.
248 :VCSStatus                                              *:VCSStatus*
250 Displays versioning information about the current file in a new scratch
251 buffer.  All parameters are passed to the underlying VCS.
254 :VCSUnlock                                              *:VCSUnlock*
256 Unlocks the current file in order to allow other users from concurrently
257 modifying it.  The exact semantics of this command depend on the underlying
258 VCS.  All parameters are passed to the underlying VCS.
260 :VCSUpdate                                              *:VCSUpdate*
262 Updates the current file with any relevant changes from the repository.  This
263 intentionally does not automatically reload the current buffer, though vim
264 should prompt the user to do so if the underlying file is altered by this
265 command.
267 :VCSVimDiff                                             *:VCSVimDiff*
269 Uses vimdiff to display differences between versions of the current file.
271 If no revision is specified, the most recent version of the file on the
272 current branch is used.  With one argument, that argument is used as the
273 revision as above.  With two arguments, the differences between the two
274 revisions is displayed using vimdiff.
275                                                             
276 With either zero or one argument, the original buffer is used to perform the
277 vimdiff.  When the scratch buffer is closed, the original buffer will be
278 returned to normal mode.
279                                                             
280 Once vimdiff mode is started using the above methods, additional vimdiff
281 buffers may be added by passing a single version argument to the command.
282 There may be up to 4 vimdiff buffers total.
283                                                             
284 Using the 2-argument form of the command resets the vimdiff to only those 2
285 versions.  Additionally, invoking the command on a different file will close
286 the previous vimdiff buffers.
288 :CVSEdit                                                *:CVSEdit*
290 This command performs "cvs edit" on the current file.  Yes, the output buffer
291 in this case is almost completely useless.
293 :CVSEditors                                             *:CVSEditors*
295 This command performs "cvs edit" on the current file.
297 :CVSUnedit                                              *:CVSUnedit*
299 Performs "cvs unedit" on the current file.  Again, yes, the output buffer here
300 is basically useless.
302 :CVSWatch                                               *:CVSWatch*
304 This command takes an argument which must be one of [on|off|add|remove].  The
305 command performs "cvs watch" with the given argument on the current file.
307 :CVSWatchAdd                                            *:CVSWatchAdd*
309 This command is an alias for ":CVSWatch add"
311 :CVSWatchOn                                             *:CVSWatchOn*
313 This command is an alias for ":CVSWatch on"
315 :CVSWatchOff                                            *:CVSWatchOff*
317 This command is an alias for ":CVSWatch off"
319 :CVSWatchRemove                                         *:CVSWatchRemove*
321 This command is an alias for ":CVSWatch remove"
323 :CVSWatchers                                            *:CVSWatchers*
325 This command performs "cvs watchers" on the current file.
327 4.2 Mappings                                            *vcscommand-mappings*
329 By default, a mapping is defined for each command.  These mappings execute the
330 default (no-argument) form of each command.
332 |<Leader>|ca VCSAdd
333 |<Leader>|cn VCSAnnotate
334 |<Leader>|cN VCSAnnotate!
335 |<Leader>|cc VCSCommit
336 |<Leader>|cD VCSDelete
337 |<Leader>|cd VCSDiff
338 |<Leader>|cg VCSGotoOriginal
339 |<Leader>|cG VCSGotoOriginal!
340 |<Leader>|ci VCSInfo
341 |<Leader>|cl VCSLog
342 |<Leader>|cL VCSLock
343 |<Leader>|cr VCSReview
344 |<Leader>|cs VCSStatus
345 |<Leader>|cu VCSUpdate
346 |<Leader>|cU VCSUnlock
347 |<Leader>|cv VCSVimDiff
349 Only for CVS buffers:
351 |<Leader>|ce CVSEdit
352 |<Leader>|cE CVSEditors
353 |<Leader>|ct CVSUnedit
354 |<Leader>|cwv CVSWatchers
355 |<Leader>|cwa CVSWatchAdd
356 |<Leader>|cwn CVSWatchOn
357 |<Leader>|cwf CVSWatchOff
358 |<Leader>|cwf CVSWatchRemove
360                                                 *vcscommand-mappings-override*
362 The default mappings can be overridden by user-provided instead by mapping to
363 <Plug>CommandName.  This is especially useful when these mappings collide with
364 other existing mappings (vim will warn of this during plugin initialization,
365 but will not clobber the existing mappings).
367 There are three methods for controlling mapping:
369 First, maps can be overriden for individual commands.  For instance, to
370 override the default mapping for :VCSAdd to set it to '\add', add the
371 following to the vimrc:
373 nmap \add <Plug>VCSAdd
375 Second, the default map prefix ('<Leader>c') can be overridden by defining the
376 |VCSCommandMapPrefix| variable.
378 Third, the entire set of default maps can be overridden by defining the
379 |VCSCommandMappings| variable.
382 4.3 Automatic buffer variables                  *vcscommand-buffer-variables*
384 Several buffer variables are defined in each vcscommand result buffer.  These
385 may be useful for additional customization in callbacks defined in the event
386 handlers (please see |vcscommand-events|).
388 The following variables are automatically defined:
390 b:VCSCommandOriginalBuffer                      *b:VCSCommandOriginalBuffer*
392 This variable is set to the buffer number of the source file.
394 b:VCSCommandCommand                             *b:VCSCommandCommand*
396 This variable is set to the name of the vcscommand that created the result
397 buffer.
399 b:VCSCommandSourceFile                          *b:VCSCommandSourceFile*
401 This variable is set to the name of the original file under source control.
403 b:VCSCommandVCSType                             *b:VCSCommandVCSType*
405 This variable is set to the type of the source control.  This variable is also
406 set on the original file itself.
407 ==============================================================================
409 5. Configuration and customization                      *vcscommand-customize*
410                                                         *vcscommand-config*
412 The vcscommand plugin can be configured in several ways:  by setting
413 configuration variables (see |vcscommand-options|) or by defining vcscommand
414 event handlers (see |vcscommand-events|).  Additionally, the vcscommand plugin
415 supports a customized status line (see |vcscommand-statusline| and
416 |vcscommand-buffer-management|).
418 5.1 vcscommand configuration variables                  *vcscommand-options*
420 Several variables affect the plugin's behavior.  These variables are checked
421 at time of execution, and may be defined at the window, buffer, or global
422 level and are checked in that order of precedence.
425 The following variables are available:
427 |VCSCommandCommitOnWrite|
428 |VCSCommandCVSDiffOpt|
429 |VCSCommandCVSExec|
430 |VCSCommandDeleteOnHide|
431 |VCSCommandDiffSplit|
432 |VCSCommandDisableAll|
433 |VCSCommandDisableMappings|
434 |VCSCommandDisableExtensionMappings|
435 |VCSCommandEdit|
436 |VCSCommandEnableBufferSetup|
437 |VCSCommandMappings|
438 |VCSCommandMapPrefix|
439 |VCSCommandResultBufferNameExtension|
440 |VCSCommandResultBufferNameFunction|
441 |VCSCommandSplit|
442 |VCSCommandSVKExec|
443 |VCSCommandSVNDiffExt|
444 |VCSCommandSVNDiffOpt|
445 |VCSCommandSVNExec|
446 |VCSCommandVCSTypeOverride|
448 VCSCommandCommitOnWrite                         *VCSCommandCommitOnWrite*
450 This variable, if set to a non-zero value, causes the pending commit
451 to take place immediately as soon as the log message buffer is written.
452 If set to zero, only the VCSCommit mapping will cause the pending commit to
453 occur.  If not set, it defaults to 1.
455 VCSCommandCVSExec                               *VCSCommandCVSExec*
457 This variable controls the executable used for all CVS commands  If not set,
458 it defaults to "cvs".
460 VCSCommandDeleteOnHide                          *VCSCommandDeleteOnHide*
462 This variable, if set to a non-zero value, causes the temporary result buffers
463 to automatically delete themselves when hidden.
465 VCSCommandCVSDiffOpt                            *VCSCommandCVSDiffOpt*
467 This variable, if set, determines the options passed to the diff command of
468 CVS.  If not set, it defaults to 'u'.
470 VCSCommandDiffSplit                             *VCSCommandDiffSplit*
472 This variable overrides the |VCSCommandSplit| variable, but only for buffers
473 created with |:VCSVimDiff|.
475 VCSCommandDisableAll                            *VCSCommandDisableAll*
477 This variable, if set, prevents the plugin or any extensions from loading at
478 all.  This is useful when a single runtime distribution is used on multiple
479 systems with varying versions.
481 VCSCommandDisableMappings                       *VCSCommandDisableMappings*
483 This variable, if set to a non-zero value, prevents the default command
484 mappings from being set.  This supercedes 
485 |VCSCommandDisableExtensionMappings|.
487 VCSCommandDisableExtensionMappings      *VCSCommandDisableExtensionMappings*
489 This variable, if set to a non-zero value, prevents the default command
490 mappings from being set for commands specific to an individual VCS.
492 VCSCommandEdit                                  *VCSCommandEdit*
494 This variable controls whether the original buffer is replaced ('edit') or
495 split ('split').  If not set, it defaults to 'split'.
497 VCSCommandEnableBufferSetup                     *VCSCommandEnableBufferSetup*
499 This variable, if set to a non-zero value, activates VCS buffer management
500 mode see (|vcscommand-buffer-management|).  This mode means that the
501 'VCSCommandBufferInfo' variable is filled with version information if the file
502 is VCS-controlled.  This is useful for displaying version information in the
503 status bar.
505 VCSCommandMappings                              *VCSCommandMappings*
507 This variable, if set, overrides the default mappings used for shortcuts.  It
508 should be a List of 2-element Lists, each containing a shortcut and function
509 name pair.  The value of the '|VCSCommandMapPrefix|' variable will be added to
510 each shortcut.
512 VCSCommandMapPrefix                             *VCSCommandMapPrefix*
514 This variable, if set, overrides the default mapping prefix ('<Leader>c').
515 This allows customization of the mapping space used by the vcscommand
516 shortcuts.
518 VCSCommandResultBufferNameExtension     *VCSCommandResultBufferNameExtension*
520 This variable, if set to a non-blank value, is appended to the name of the VCS
521 command output buffers.  For example, '.vcs'.  Using this option may help
522 avoid problems caused by autocommands dependent on file extension.
524 VCSCommandResultBufferNameFunction      *VCSCommandResultBufferNameFunction*
526 This variable, if set, specifies a custom function for naming VCS command
527 output buffers.  This function is expected to return the new buffer name, and
528 will be passed the following arguments:
530   command - name of the VCS command being executed (such as 'Log' or
531   'Diff').
532   
533   originalBuffer - buffer number of the source file.
534   
535   vcsType - type of VCS controlling this file (such as 'CVS' or 'SVN').
536   
537   statusText - extra text associated with the VCS action (such as version
538   numbers).
540 VCSCommandSplit                                 *VCSCommandSplit*
542 This variable controls the orientation of the various window splits that
543 may occur.
545 If set to 'horizontal', the resulting windows will be on stacked on top of
546 one another.  If set to 'vertical', the resulting windows will be
547 side-by-side.  If not set, it defaults to 'horizontal' for all but
548 VCSVimDiff windows.  VCSVimDiff windows default to the user's 'diffopt'
549 setting, if set, otherwise 'vertical'.
551 VCSCommandSVKExec                               *VCSCommandSVKExec*
553 This variable controls the executable used for all SVK commands  If not set,
554 it defaults to "svk".
556 VCSCommandSVNDiffExt                            *VCSCommandSVNDiffExt*
558 This variable, if set, is passed to SVN via the --diff-cmd command to select
559 an external application for performing the diff.
561 VCSCommandSVNDiffOpt                            *VCSCommandSVNDiffOpt*
563 This variable, if set, determines the options passed with the '-x' parameter
564 to the SVN diff command.  If not set, no options are passed.
566 VCSCommandSVNExec                               *VCSCommandSVNExec*
568 This variable controls the executable used for all SVN commands  If not set,
569 it defaults to "svn".
571 VCSCommandVCSTypeOverride                       *VCSCommandVCSTypeOverride*
573 This variable allows the VCS type detection to be overridden on a path-by-path
574 basis.  The value of this variable is expected to be a List of Lists.  Each
575 item in the high-level List is a List containing two elements.  The first
576 element is a regular expression that will be matched against the full file
577 name of a given buffer.  If it matches, the second element will be used as the
578 VCS type.
580 5.2 VCSCommand events                           *vcscommand-events*
582 For additional customization, vcscommand can trigger user-defined events.
583 Event handlers are provided by defining User event autocommands (see
584 |autocommand|, |User|) in the vcscommand group with patterns matching the
585 event name.
587 For instance, the following could be added to the vimrc to provide a 'q'
588 mapping to quit a vcscommand scratch buffer:
590 augroup VCSCommand
591   au User VCSBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr>
592 augroup END
594 The following hooks are available:
596 VCSBufferCreated                This event is fired just after a vcscommand
597                                 result buffer is created and populated.  It is
598                                 executed within the context of the vcscommand
599                                 buffer.  The vcscommand buffer variables may
600                                 be useful for handlers of this event (please
601                                 see |vcscommand-buffer-variables|).
603 VCSBufferSetup                  This event is fired just after vcscommand buffer
604                                 setup occurs, if enabled.
606 VCSPluginInit                   This event is fired when the vcscommand plugin
607                                 first loads.
609 VCSPluginFinish                 This event is fired just after the vcscommand
610                                 plugin loads.
612 VCSVimDiffFinish                This event is fired just after the VCSVimDiff
613                                 command executes to allow customization of,
614                                 for instance, window placement and focus.
616 Additionally, there is another hook which is used internally to handle loading
617 the multiple scripts in order.  This hook should probably not be used by an
618 end user without a good idea of how it works.  Among other things, any events
619 associated with this hook are cleared after they are executed (during
620 vcscommand.vim script initialization).
622 VCSLoadExtensions               This event is fired just before the
623                                 VCSPluginFinish.  It is used internally to
624                                 execute any commands from the VCS
625                                 implementation plugins that needs to be
626                                 deferred until the primary plugin is
627                                 initialized.
629 5.3 vcscommand buffer naming                            *vcscommand-naming*
631 vcscommand result buffers use the following naming convention:
632 [{VCS type} {VCS command} {Source file name}]
634 If additional buffers are created that would otherwise conflict, a
635 distinguishing number is added:
637 [{VCS type} {VCS command} {Source file name}] (1,2, etc)
639 5.4 vcscommand status line support                      *vcscommand-statusline*
641 It is intended that the user will customize the |'statusline'| option to
642 include vcscommand result buffer attributes.  A sample function that may be
643 used in the |'statusline'| option is provided by the plugin,
644 VCSCommandGetStatusLine().  In order to use that function in the status line, do
645 something like the following:
647 set statusline=%<%f\ %{VCSCommandGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P
649 of which %{VCSCommandGetStatusLine()} is the relevant portion.
651 The sample VCSCommandGetStatusLine() function handles both vcscommand result
652 buffers and VCS-managed files if vcscommand buffer management is enabled
653 (please see |vcscommand-buffer-management|).
655 5.5 vcscommand buffer management                *vcscommand-buffer-management*
657 The vcscommand plugin can operate in buffer management mode, which means that
658 it attempts to set a buffer variable ('VCSCommandBufferInfo') upon entry into
659 a buffer.  This is rather slow because it means that the VCS will be invoked
660 at each entry into a buffer (during the |BufEnter| autocommand).
662 This mode is disabled by default.  In order to enable it, set the
663 |VCSCommandEnableBufferSetup| variable to a true (non-zero) value.  Enabling
664 this mode simply provides the buffer variable mentioned above.  The user must
665 explicitly include information from the variable in the |'statusline'| option
666 if they are to appear in the status line (but see |vcscommand-statusline| for
667 a simple way to do that).
669 The 'VCSCommandBufferInfo' variable is a list which contains, in order, the
670 revision of the current file, the latest revision of the file in the
671 repository, and (for CVS) the name of the branch.  If those values cannot be
672 determined, the list is a single element:  'Unknown'.
674 ==============================================================================
676 6. SSH "integration"                                    *vcscommand-ssh*
678 The following instructions are intended for use in integrating the
679 vcscommand.vim plugin with an SSH-based CVS environment.
681 Familiarity with SSH and CVS are assumed.
683 These instructions assume that the intent is to have a message box pop up in
684 order to allow the user to enter a passphrase.  If, instead, the user is
685 comfortable using certificate-based authentication, then only instructions
686 6.1.1 and 6.1.2 (and optionally 6.1.4) need to be followed; ssh should then
687 work transparently.
689 6.1 Environment settings                                *vcscommand-ssh-env*
691 6.1.1 CVSROOT should be set to something like:
693         :ext:user@host:/path_to_repository
695 6.1.2 CVS_RSH should be set to:
697         ssh
699         Together, those settings tell CVS to use ssh as the transport when
700         performing CVS calls.
702 6.1.3 SSH_ASKPASS should be set to the password-dialog program.  In my case,
703         running gnome, it's set to:
705         /usr/libexec/openssh/gnome-ssh-askpass
707         This tells SSH how to get passwords if no input is available.
709 6.1.4 OPTIONAL.  You may need to set SSH_SERVER to the location of the cvs
710         executable on the remote (server) machine.
712 6.2 CVS wrapper program                         *vcscommand-ssh-wrapper*
714 Now you need to convince SSH to use the password-dialog program.  This means
715 you need to execute SSH (and therefore CVS) without standard input.  The
716 following script is a simple perl wrapper that dissasociates the CVS command
717 from the current terminal.  Specific steps to do this may vary from system to
718 system; the following example works for me on linux.
720 #!/usr/bin/perl -w
721 use strict;
722 use POSIX qw(setsid);
723 open STDIN, '/dev/null';
724 fork and do {wait; exit;};
725 setsid;
726 exec('cvs', @ARGV);
728 6.3 Configuring vcscommand.vim                  *vcscommand-ssh-config*
730 At this point, you should be able to use your wrapper script to invoke CVS with
731 various commands, and get the password dialog.  All that's left is to make CVS
732 use your newly-created wrapper script.
734 6.3.1 Tell vcscommand.vim what CVS executable to use.  The easiest way to do this
735         is globally, by putting the following in your .vimrc:
737         let VCSCommandCVSExec=/path/to/cvs/wrapper/script
739 6.4 Where to go from here                       *vcscommand-ssh-other*
741 The script given above works even when non-SSH CVS connections are used,
742 except possibly when interactively entering the message for CVS commit log
743 (depending on the editor you use... VIM works fine).  Since the vcscommand.vim
744 plugin handles that message without a terminal, the wrapper script can be used
745 all the time.
747 This allows mixed-mode operation, where some work is done with SSH-based CVS
748 repositories, and others with pserver or local access.
750 It is possible, though beyond the scope of the plugin, to dynamically set the
751 CVS executable based on the CVSROOT for the file being edited.  The user
752 events provided (such as VCSBufferCreated and VCSBufferSetup) can be used to
753 set a buffer-local value (b:VCSCommandCVSExec) to override the CVS executable
754 on a file-by-file basis.  Alternatively, much the same can be done (less
755 automatically) by the various project-oriented plugins out there.
757 It is highly recommended for ease-of-use that certificates with no passphrase
758 or ssh-agent are employed so that the user is not given the password prompt
759 too often.
761 ==============================================================================
763 7. Changes from cvscommand                              *cvscommand-changes*
765 1.  Require Vim 7 in order to leverage several convenient features; also
766 because I wanted to play with Vim 7.
768 2.  Renamed commands to start with 'VCS' instead of 'CVS'.  The exceptions are
769 the 'CVSEdit' and 'CVSWatch' family of commands, which are specific to CVS.
771 3.  Renamed options, events to start with 'VCSCommand'.
773 4.  Removed option to jump to the parent version of the current line in an
774 annotated buffer, as opposed to the version on the current line.  This made
775 little sense in the branching scheme used by subversion, where jumping to a
776 parent branch required finding a different location in the repository.  It
777 didn't work consistently in CVS anyway.
779 5.  Removed option to have nameless scratch buffers.
781 6.  Changed default behavior of scratch buffers to split the window instead of
782 displaying in the current window.  This may still be overridden using the
783 'VCSCommandEdit' option.
785 7.  Split plugin into multiple plugins.
787 8.  Added 'VCSLock' and 'VCSUnlock' commands.  These are implemented for
788 subversion but not for CVS.  These were not kept specific to subversion as they
789 seemed more general in nature and more likely to be supported by any future VCS
790 supported by this plugin.
792 9.  Changed name of buffer variables set by commands.
794 'b:cvsOrigBuffNR' became 'b:VCSCommandOriginalBuffer'
795 'b:cvscmd' became 'b:VCSCommandCommand'
797 10.  Added new automatic variables to command result buffers.
799 'b:VCSCommandSourceFile'
800 'b:VCSCommandVCSType'
802 ==============================================================================
804 8. Known bugs                                           *vcscommand-bugs*
806 Please let me know if you run across any.
808 CVSUnedit may, if a file is changed from the repository, provide prompt text
809 to determine whether the changes should be thrown away.  Currently, that text
810 shows up in the CVS result buffer as information; there is no way for the user
811 to actually respond to the prompt and the CVS unedit command does nothing.  If
812 this really bothers anyone, please let me know.
814 VCSVimDiff, when using the original (real) source buffer as one of the diff
815 buffers, uses some hacks to try to restore the state of the original buffer
816 when the scratch buffer containing the other version is destroyed.  There may
817 still be bugs in here, depending on many configuration details.
819 vim:tw=78:ts=8:ft=help