writebackup 1.20.006

writebackup is a Vim plugin that writes backups of current file with date file extension.
writebackup is a Vim plugin that writes backups of current file with date file extension.

This is a poor man's revision control system, a primitive alternative to CVS, RCS, Subversion, etc., which works with no additional software and almost any file system.

The ':WriteBackup' command writes subsequent backups of the current file with a 'current date + counter' file extension (format '.YYYYMMDD[a-z]'). The first backup of a day has letter 'a' appended, the next 'b', and so on. (Which means that a file can be backed up up to 26 times on any given day.)

By default, backups are created in the same directory as the original file, but they can also be placed in a directory relative to the original file, or in one common backup directory for all files (similar to VIM's 'backupdir' option).


For a permanent configuration, put the following commands into your vimrc file (see :help vimrc).

To put backups into another directory, specify a backup directory via
let g:writebackup_BackupDir = 'D:backups'
Please note that this setting may result in name clashes when backing up
files with the same name from different directories!

A directory starting with "./" (or "." for MS-DOS et al.) puts the backup
file relative to where the backed-up file is. The leading "." is replaced with the path name of the current file:
let g:writebackup_BackupDir = './backups'

You can override this global setting for specific buffers via a buffer-scoped variable, which can be set by an autocmd, ftplugin, or manually:
let b:writebackup_BackupDir = 'X:specialbackupfolder'

In case you already have other custom VIM commands starting with W, you can define a shorter command alias ':W' in your .vimrc to save some keystrokes.

Developer comments

I like the parallelism between ':w' for a normal write and ':W' for a backup write.
command W :WriteBackup


· Vim

What's New in This Release:

· Minor change: Added -bar to :WriteBackup, so that commands can be chained together.

last updated on:
June 24th, 2008, 22:10 GMT
license type:
GPL (GNU General Public License) 
developed by:
Ingo Karkat
ROOT \ Text Editing&Processing \ Vim Plugins
Download Button

In a hurry? Add it to your Download Basket!

user rating 11



Rate it!

Add your review!