sponsor Vim development Vim logo Vim Book Ad

rcsvers.vim : Use RCS to keep a backup version whenever you save a file

 script karma  Rating 204/68, Downloaded by 7655  Comments, bugs, improvements  Vim wiki

created by
Roger Pilkey
script type
A Vim plugin for automatically saving backup versions in RCS whenever a file is saved.  You can compare to any revision as well.
keywords: VCS, version control system, incremental saving, automatic versioning, automatic journalling or journaling, or autosave backups with versions.

The maintainer is Juan Frias (juandfrias at gmail.com)

What's RCS? It's the Revision Control System, a set of programs used for keeping many versions of a file. See http://www.gnu.org/software/rcs/rcs.html

The RCS programs are freely available at http://www.cs.purdue.edu/homes/trinkle/RCS/

Be careful if you really use RCS as your production file control, it will add versions like crazy.  See the g:rvMode option to have more control over when a save is added to the revision file.

rcs-menu.vim by Jeff Lanzarotta is handy to have along with this (vimscript #41).

Inspired by savevers.vim by Ed Ralston (vimscript #89).

Mapped Keys:
               <Leader>rci     This will create an initial RCS file.  Only
                                      necessary when you have the script set to
                                      save only when a previous RCS file exists.
               <Leader>rlog    To access the saved revisions log.  This works as
                                      a toggle to quit the revision windows too.

               <enter>         This will compare the current file to the
                                    revision under the cursor (works only in
                                    the revision log window)

               <Leader>older   does a diff with the previous version

               <Leader>newer   does a diff with the next version

You probably want to map these in your _vimrc to something easier to type,
like a function key.  Do it like this:
"re-map rcsvers.vim keys
map <F9> \rci
map <F8> \rlog
map <F5> \older
map <F6> \newer

You may need to set the following shell(environment) variables, you'll get a warning if so:
user name:

Look here if you have problems with Daylight Saving Time (DST) with RCS after 2007 on Microsoft Windows:  http://support.microsoft.com/kb/932590

2013-10-16: Roger says: This seems to have broken between vim 7.3 and vim 7.4, on Windows, when saving versions of files where the file is in a folder with parentheses e.g. ()

Backing out to vim 7.3 fixed the problem.

If you can help figure it out, put something on the wiki page (link at the top of this page)
install details
Drop it in your plugin directory.  Your RCS executables must be in your path.  There are lots of options, but by default it acts exactly like RCS from the command line.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
rcsvers.vim 1.28 2010-01-06 7.0 Roger Pilkey Adds syntax highlighting to temporary files retrieved from RCS and fix of \rci to work with vim 7. (thanks to Sergey Khorev)
Also added Fredrik Eriksson's patch to allow editing of messages. (http://thebc.se/patch-for-rcsversvim)
And added the -d option to preserve original modification times. (Roger)
Removed the rvtempdir in favor of more secure tempname() call. (Roger)
We used to skip the pre-checkin, but I think we should do it, if someone or something else has modified the file since the last RCS version then we will put their version in the RCS file. (Roger)
rcsvers.vim 1.27 2007-04-17 6.0 Roger Pilkey Add a new mode for revising (never/ask/always) and fix rlog window width, both thanks to Callum Gibson.  See g:rvMode .
rcsvers.vim 1.26 2007-01-11 6.0 Roger Pilkey Fix for Windows for usernames with spaces (from Roger), and macosx directory separator (thanks to Jeff Fox)
rcsvers.vim 1.25 2006-01-21 6.0 Roger Pilkey Fix for Windows if you don't have the TZ variable set, and fix how it works when saving a file to another name.
rcsvers.vim 1.24 2005-10-18 6.0 Roger Pilkey Just updating author/maintainer email addresses.
rcsvers.vim 1.24 2005-09-22 6.0 Roger Pilkey RCS sets the executable bit on the checked-out file to be the same as the rcs archive file.  So if that property changes after you did your first checkin, your checked-out file will maintain the original setting. So now we change the executable mode of the rcs archive file to align with the current setting of the checked-out copy. Thanks to Ben Bernard.
rcsvers.vim 1.23 2005-04-06 6.0 Roger Pilkey Added an option to fix the path on Cygwin systems.  
See g:rvUseCygPathFiltering  
Thanks to Simon Johann-Günter
rcsvers.vim 1.22 2005-03-16 6.0 Roger Pilkey some re-factoring, and add the option to leave RCS files unlocked when saving, which is handy for multiple users of the same RCS file.  
See g:rvLeaveRcsUnlocked. (from Roger Pilkey)
rcsvers.vim 1.21 2004-07-24 6.0 Roger Pilkey small update: Remember the last position in the rlog window. Rename RevisionLog window to avoid collisions
rcsvers.vim 1.20 2004-06-28 6.0 Roger Pilkey Added a mapping to create an initial RCS file. Useful when the script
is set to save only when a previous RCS file exists. see
rvSaveIfPreviousRCSFileExists (thanks to Steven Michalske for the
suggestion) Added <silent> to the default mappings to keep the status
bar clean.
rcsvers.vim 1.19 2004-06-10 6.0 Roger Pilkey 1.19  Added the option to prompt the user for file and check-in message on
every save. See rvDescMsgPrompt option for details. Thanks to Kevin
Stegemoller for the suggestion. Also \rlog will now display the
check-in message in the pick list for easier identification.
rcsvers.vim 1.18 2004-02-26 6.0 Roger Pilkey Added the option to save an RCS version only if the RCS file already
  exists (No new RCS files will be created). (from Marc Schoechlin)
  See rvSaveIfPreviousRCSFileExists option.
rcsvers.vim 1.17 2004-01-28 6.0 Roger Pilkey Added the option to save an RCS version only when there is an RCS
directory in the files directory. See rvSaveIfRCSExists option.
(from Camillo Särs)
rcsvers.vim 1.16 2003-12-09 6.0 Roger Pilkey Save some settings that "set diff" mangles, and different check for &cp
rcsvers.vim 1.15 2003-09-16 6.0 Roger Pilkey Add functions to go back and forth between versions (mapped to \older and \newer). It's kind of jerky, but comes in handy sometimes. Also fixed a few bugs with quotes.
rcsvers.vim 1.14 2003-06-09 6.0 Roger Pilkey Add option to set "rlog" command-line options.  fix rlog display,
which would crash once in a while saying stuff like "10,10d invalid
range". When creating a new RCS file on an existing text file, save a
version before adding the new revision.

rcsvers.vim 1.13 2003-05-08 6.0 Roger Pilkey A g:rvFileQuote fix, suggested by Wiktor Niesiobedzki.  Add the ability to use the current instance of vim for the diff, which is now the default.  Change the name of the diff temp file to include the version.  Make \rlog a toggle (on/off)
rcsvers.vim 1.12 2003-03-28 6.0 Roger Pilkey 1.12  (From Juan Frias) Script will not load if the 'cp' flag is set. Added the option to use an exclude expression, and include expression.  Fixed yet more bugs thanks to Roger for all the beta testing.
rcsvers.vim 1.11 2003-03-10 6.0 Roger Pilkey (for Juan Frias) Minor bug fix, when using spaces in the description.
Also added some error detection code to check and see that RCS
and CI were successful. And removed requirements for SED and GREP,
script will no longer need these to display the log.

rcsvers.vim 1.10 2003-03-03 6.0 Juan Frias Fixed some major bugs with files with long filenames and spaces Win/Dos systems. Added a variable to pass additional options to the initial RCS check in. Fixed some documentations typos.
rcsvers.vim 1.9 2003-02-28 6.0 Juan Frias Added even more options, the ability to set your own description and pass additional options to CI command. Dos/Win Temp directory is taken from the $TEMP environment variable, and quote filenames when using diff program to prevent errors with long filenames with spaces. Also removed confirm box from script. (Thanx Roger for all the beta testing)
rcsvers.vim 1.8 2003-02-28 6.0 Juan Frias Minor suffix bug fix. Required if you are using suffixes.
rcsvers.vim 1.7 2003-02-27 6.0 Juan Frias 1.7   Will not alter the $xx$ tags when automaticaly checking in files.
      (Thanks to Engelbert Gruber). Added option to save under the current
      directory with no RCS sub directory. Also added the option to choose
      your own suffixes.
rcsvers.vim 1.6 2003-02-24 6.0 Juan Frias Complete script re-write. It now allows user define options and the ability to compare to older revisions if you have SED and GREP installed. Working on a way to get rid of these external program in a later version.
rcsvers.vim 1.5 2003-02-20 6.0 engelbert gruber FIX files in current directory - RCS in filedirectory.
+ Check for file .novimrcs in files directory to skip versioning.
rcsvers.vim 1.4 2003-02-20 6.0 engelbert gruber FIX editing files not in current directory.
rcsvers.vim 1.3 2003-02-19 6.0 Roger Pilkey error in uploading
rcsvers.vim 1.2 2003-02-19 6.0 Roger Pilkey option to select the rcs directory, and better comments thanks to Juan Frias
rcsvers.vim 1.0 2003-02-12 6.0 Roger Pilkey Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
OSDN.net Logo