writebackup


Ⅰ. 插件描述

Write backups of current file with date file extension.

Ⅱ. 基本信息

创建日期:  2007-03-16
使用用户:  2
Github星:  1
插件作者:  Ingo Karkat

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/writebackup'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/writebackup'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/writebackup'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/writebackup

Ⅳ. 文档说明

DESCRIPTION
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. (So 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), or even in a file-specific location that is determined via a
user-provided callback function.

SEE ALSO

  • The writebackupVersionControl.vim plugin (vimscript #1829) complements
      this script with additional commands and enhances the :WriteBackup command

  with more checks, but is not required.

  • The writebackupToAdjacentDir.vim plugin (vimscript #3107) implements a
      WriteBackup-dynamic-backupdir configuration that puts the backup files in

  an adjacent backup directory if one exists. This helps where the backups
  cannot be placed into the same directory.

  • The writebackupAutomator.vim plugin (vimscript #3940) automatically writes
      a backup on a day's first write of a file that was backed up in the past,

  but not yet today. It can be your safety net when you forget to make a
  backup.

USAGE
:WriteBackup[!]
                        Write the whole current buffer to the next available
                        backup file with a '.YYYYMMDD[a-z]' file extension.
                        If the last backup is identical with the current
                        buffer contents, no (redundant) backup is written.
                        With [!], creation of a new backup file is forced:
                        - even if the last backup is identical
                        - even when no more backup versions (for this day) are
                          available (the last '.YYYYMMDDz' backup gets
                          overwritten, even if it is readonly)

PS: In addition to this Vim plugin, I also provide the basic writebackup
functionality outside of Vim as VBScript and Bash Shell script versions at
http://ingo-karkat.de/downloads/tools/writebackup/index.html

添加新评论