writebackupToAdjacentDir


Ⅰ. 插件描述

Backup to an adjacent backup directory.

Ⅱ. 基本信息

创建日期:  2010-06-02
使用用户:  1
Github星:  1
插件作者:  Ingo Karkat

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

Redirect backups made by the writebackup plugin (vimscript #1828) that would
normally go into the original file's directory into an adjacent directory with a
"{dir}.backup" name, if it exists. This allows to use the plugin in places where
backup files would cause problems.

DESCRIPTION
Many customization directories (e.g. /etc/profile.d/) consider all contained
files, regardless of file extension or execute permissions. Creating a
{file}.YYYYMMDD[a-z] backup in there causes trouble and strange effects,
because the backups are used in addition to the main configuration file - not
what was intended! However, putting the backups in the same directory
generally is a good idea - just not for these special directories.

This plugin offers a solution by integrating into the writebackup.vim plugin
so that it checks for a directory with a '.backup' extension (e.g.
/etc/profile.d.backup/), and places the backups in there, in case it exists.
In all other cases, the backup is made in the default directory, as before.

USAGE
Adjacent backup directories are never created by this plugin; you have to
create such a directory yourself to indicate that backups should be placed in
there.

:WriteBackupMakeAdjacentDir [../..|/path/to/dir] [{prot}]
                Create a backup directory adjacent to the current file's
                directory, or in a parent of that ("..", "../..", etc.), or of
                any passed directory.
                If {prot} is given it is used to set the protection bits;
                default is 0755.

After the adjacent backup directory has been created, just use :WriteBackup
as before.

添加新评论