Ⅰ. 插件描述
Version control functions (diff, restore, history) for writebackup backups.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/writebackupversioncontrol'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/writebackupversioncontrol'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/writebackupversioncontrol'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/writebackupVersionControl
Ⅳ. 文档说明
Version control functions (diff, restore, history navigation) for backups made
with the writebackup plugin, which have a date file extension in the format
'.YYYYMMDD[a-z]'.
DESCRIPTION
This plugin enhances the primitive file backup mechanism provided by
writebackup.vim with some functions of real revision control systems like
CVS, RCS or Subversion - without additional software.
Via Vim commands, you can list and go to all backup versions that exist for
the current file, check whether you have a current backup, backup the saved
version of the buffer even after you've made unsaved changes in the buffer
(which is useful for after-the-fact backups).
Within Vim, you can create a diff with the previous version, restore the
current file from its predecessor or any other backed-up version.
USAGE
:WriteBackupListVersions
List all backup versions that exist for the current
file. If the file isn't the original, it is marked in
the version list. If the file is the original, the
time that has passed since the last backup is printed,
too.
:[count]WriteBackupGoPrev[!]
:[count]WriteBackupGoNext[!]
Open a backup file version relative to the current
backup or original file (with 'readonly' set to
prevent accidental edits) . You can skip multiple
backups via the optional [count]; if the resulting
index is out of bounds, the first / last available
backup version is edited.
Thus, :999WriteBackupGoPrev edits the very first
existing backup, and :999WriteBackupGoNext edits the
latest (i.e. most recent) backup.
With [!], any changes to the current version are
discarded.
:WriteBackupGoOriginal[!]
Edit the original of the current backup file. If
backups are stored in a different directory, it may
not be possible to determine the original file. With
[!], any changes to the current version are discarded.
:WriteBackupIsBackedUp
Check whether the latest backup is identical to the
(saved version of the) current file (which must be the
original file).
:[count]WriteBackupDiffWithPred
Perform a diff of the current file (which may be the
original file or any backup) with the [count]'th
previous version. If the resulting index is out of
bounds, the first available backup version is used.
The diff is done inside Vim, with a new :diffsplit
being opened.
:[count]WriteBackupViewDiffWithPred [{diff-arguments}]
Show the differences of the current file (which may be
the original file or any backup) with the [count]'th
previous version. If the resulting index is out of
bounds, the first available backup version is used.
The diff output is opened in a split scratch buffer.
Any {diff-arguments} are passed as-is to the diff
executable. The "icase" and "iwhite" settings of
'diffopt' are used, too.
The current working directory is used as the diff root
directory (in which the diff command will be invoked)
You can set the diff root via:
:lcd {diff-root} | WriteBackupViewDiffWithPred | lcd -
Use the :saveas command if you want to persist the
diff scratch buffer on disk. Rename the scratch buffer
via the :file command if you want to keep it and
prevent further updates.
+ [count]du
By repeating the command, an existing scratch buffer
is updated; no new split is created. One can also
update the differences by repeating
:WriteBackupViewDiffWithPred in the diff scratch
buffer itself, or through the buffer-local [count]du
mapping. The mapping will update with the same diff
options used previously; the command can be repeated
with the same or different {diff-arguments}. For
example, you can change a context diff created via
:WriteBackupViewDiffWithPred -c
into the unified format by repeating via >
:WriteBackupViewDiffWithPred -u
If you repeat with a [count], a new predecessor is
chosen for the updated diff; the newer file is kept.
:[count]WriteBackupDiffDaysChanges
Perform a diff of the current file (which may be the
original file or any backup) with today's (or
[count] - 1 days ago) first backup.
The diff is done inside Vim, with a new :diffsplit
being opened.
:[count]WriteBackupViewDaysChanges [{diff-arguments}]
Show the differences of the current file (which may be
the original file or any backup) with today's (or
[count] - 1 days ago) first backup.
The diff output is opened in a split scratch buffer.
:[count]WriteBackupRestoreFromPred[!]
Overwrite the current file (which must be the
original) with the [count]'th previous backup. With
[!] skips confirmation dialog and allows to restore
over readonly original file.
:WriteBackupRestoreThisBackup[!]
Restore the current file as the original file, which
will be overwritten. With [!] skips confirmation
dialog and allows to restore over readonly original
file.
:WriteBackupOfSavedOriginal[!]
Instead of backing up the current buffer, back up the
saved version of the buffer. This comes handy when you
realize you need a backup only after you've made
changes to the buffer.
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)
:WriteBackupDeleteLastBackup[!]
Delete the last backup. With [!] skips confirmation
dialog and allows to delete readonly backup file.