PI_VIMBALL
*pi_vimball.txt* For Vim version 7.3. 最近更新: 2010年7月
Vimball 归档处理程序
译者: Willis
http://vimcdoc.sf.net
Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
Copyright: (c) 2004-2009 by Charles E. Campbell, Jr. *Vimball-copyright*
The VIM LICENSE applies to Vimball.vim, and Vimball.txt
(see |copyright|) except use "Vimball" instead of "Vim".
No warranty, express or implied.
Use At-Your-Own-Risk!
1. 内容 *vba* *vimball* *vimball-contents*
1. 内容..........................................: |vimball-contents|
2. Vimball 简介..................................: |vimball-intro|
3. Vimball 手册..................................: |vimball-manual|
MkVimball.....................................: |:MkVimball|
UseVimball....................................: |:UseVimball|
RmVimball.....................................: |:RmVimball|
4. Vimball 历史..................................: |vimball-history|
2. Vimball 简介 *vimball-intro*
Vimball 的目标就是使插件用户的使用更方便。有了 vimball 以后,用户只需
要:
vim someplugin.vba
:so %
:q
然后插件和它的所有部件都会被安装在合适的目录里。注意 用户无须刻意进到
某个特定的目录来执行此命令。另外,插件的帮助也会被自动安装。
如果用户决定使用 AsNeeded 插件,vimball 会聪明地把本来要放到
.vim/plugin/ 中的脚本放到 .vim/AsNeeded/ 里去。
删除 vimball 安装的插件很容易:
vim
:RmVimball someplugin
举例说吧,zip 和 tarball 对应的操作就不是那么简单了。
Vimball 检视用户的 |'runtimepath'| 来确定把脚本放在哪里。如果可能,通
常使用 runtimepath 提到的第一个目录。用
:echo &rtp
来查看该目录。
3. Vimball 手册 *vimball-manual*
创 建 VIMBALL *:MkVimball*
:[range]
MkVimball[!] filename [path]
行范围内指定要保存在 vimball 里的文件的路径,但不包含通常在
runtimepath (|'rtp'|) 指定的那部分。例如:
plugin/something.vim
doc/something.txt
< 在此范围的行上使用
:[range]
MkVimball filename
建立文件 "filename.vba",Vimball.vim 随后可以用它来还原那些文件。如果
文件 "filename.vba" 已经存在,MKVimball 会给出警告而不建立文件。注意
这些路径都相对于你的 .vim (vimfiles) 目录,而所有文件都应该在该目录
下。更准确地说,vimball 插件通常使用 'runtimepath' 里第一个存在的目录
作为前缀;它不使用绝对路径,除非用户指定的就是如此。
如果使用感叹号 (!),MkVimball 总是建立 "filename.vba" 文件。如果已经存
在则覆盖之。此行为和 |:w| 类似。
如要强制允许文件名中包含斜杠,也可用感叹号版本实现 (即 :MkVimball!
path/filename)。
http://vim.wikia.com/wiki/Using_VimBall_with_%27Make%27 给出的技巧提供
了用 make 自动生成 vimball 的好方法。
通 过 VIMBALL 建 立 目 录 *g:vimball_mkdir*
首先尝试 |mkdir()| 命令 (并非所有系统都支持)。
如果该命令不存在,而且 g:vimball_mkdir 也不存在,它被设为:
|g:netrw_local_mkdir|,如果存在的话
"mkdir" ,如果可执行的话
"makedir" ,如果可执行的话
否则 ,未定义
用户可以自定义 g:vimball_mkdir 来直接指定建立目录的命令。vimball 如有
需要,会通过该命令来建立目录。
控 制 VIMBALL 提 取 目 录 *g:vimball_home*
通过指定变量 g:vimball_home,你可以覆盖 |'runtimepath'| 的使用。
*vimball-extract*
vim filename.vba
简单编辑一个 vimball 文件,Vimball.vim 会告诉用户必须执行 (source) 该
归档的内容才能提取其中的文件。
只有首行是 "Vimball Archiver by Charles E. Campbell, Jr., Ph.D." 的文
件才会被认为是 vimball 文件,从而才会继续提取操作。
列 出 VIMBALL 中 的 文 件 *:VimballList*
:VimballList
本命令告诉 Vim 列出归档里的所有文件,包括每个文件的行数。
手 动 执 行 VIMABALL 提 取 *:UseVimball*
:UseVimball [path]
vimball 文件本身包含了该命令;它调用 vimball#Vimball() 例程,后者负责
对 vimball 解包。用户可以手动执行该命令,而无须执行 vimball;用户还可
以指定安装的路径来覆盖自动的选择,即 |'runtimepath'| 里的第一个存在的
目录。
删 除 VIMBALL *:RmVimball*
:RmVimball vimballfile [path]
本命令删除制定 vimball 产生的所有文件 (但不包括它可能建立的任何目录)。
用户也选择卸载文件的路径 (见 |'runtimepath'|);否则,缺省是
'runtimepath' 里的第一个存在的目录。
为了实现这一点,该目录下包含一个文件 (.VimballRecord),它包含了目前为
止所有使用过的 vimball 中要删除的文件的记录。
禁 止 载 入
如果由于某种原因你不想使用 vimball 提取插件,在 <.vimrc>
中加入以下两
个变量就可以不载入 vimball.vim:
let g:loaded_vimballPlugin= 1
let g:loaded_vimball = 1
WINDDOWS *vimball-windows*
许多 vimball 文件使用 gzip 压缩。Windows 不幸地没有自带解压 gzip 文件
的工具。幸运的是,Windows 用户可以找到不少解压 gzip 的工具:
项目 工具/套件 免费 网站
---- ---------- ---- -------
7zip 工具 是 http://www.7-zip.org/
Winzip 工具 否 http://www.winzip.com/downwz.htm
unxutils 套件 是 http://unxutils.sourceforge.net/
cygwin 套件 是 http://www.cygwin.com/
GnuWin32 套件 是 http://gnuwin32.sourceforge.net/
MinGW 套件 是 http://www.mingw.org/
4. Vimball 历史 (英文) *vimball-history* {{{1
30 : Dec 08, 2008 * fnameescape() inserted to protect error
messaging using corrupted filenames from
causing problems
* RmVimball supports filenames that would
otherwise be considered to have "magic"
characters (ie. Abc[1].vba)
Feb 18, 2009 * s:Escape(), g:vimball_shq, and g:netrw_shq
removed (shellescape() used directly)
Oct 05, 2009 * (Nikolai Weibull) suggested that MkVimball
be allowed to use slashes in the filename.
26 : May 27, 2008 * g:vimball_mkdir usage installed. Makes the
$HOME/.vim (or $HOME\vimfiles) directory if
necessary.
May 30, 2008 * (tnx to Bill McCarthy) found and fixed a bug:
vimball wasn't updating plugins to AsNeeded/
when it should
25 : Mar 24, 2008 * changed vimball#Vimball() to recognize doc/*.??x
files as help files, too.
Apr 18, 2008 * RmVimball command is now protected by saving and
restoring settings -- in particular, acd was
causing problems as reported by Zhang Shuhan
24 : Nov 15, 2007 * g:vimball_path_escape used by s:Path() to
prevent certain characters from causing trouble
22 : Mar 21, 2007 * uses setlocal instead of set during BufEnter
21 : Nov 27, 2006 * (tnx to Bill McCarthy) vimball had a header
handling problem and it now changes \s to /s
20 : Nov 20, 2006 * substitute() calls have all had the 'e' flag
removed.
18 : Aug 01, 2006 * vimballs now use folding to easily display their
contents.
* if a user has AsNeeded/somefile, then vimball
will extract plugin/somefile to the AsNeeded/
directory
17 : Jun 28, 2006 * changes all \s to /s internally for Windows
16 : Jun 15, 2006 * A. Mechelynck's idea to allow users to specify
installation root paths implemented for
UseVimball, MkVimball, and RmVimball.
* RmVimball implemented
15 : Jun 13, 2006 * bugfix
14 : May 26, 2006 * bugfixes
13 : May 01, 2006 * exists("&acd") used to determine if the acd
option exists
12 : May 01, 2006 * bugfix - the |'acd'| option is not always defined
11 : Apr 27, 2006 * VimballList would create missing subdirectories that
the vimball specified were needed. Fixed.
10 : Apr 27, 2006 * moved all setting saving/restoration to a pair of
functions. Included some more settings in them
which frequently cause trouble.
9 : Apr 26, 2006 * various changes to support Windows' prediction
for backslashes and spaces in file and directory
names.
7 : Apr 25, 2006 * bypasses foldenable
* uses more exe and less norm! (:yank :put etc)
* does better at insuring a "Press ENTER" prompt
appears to keep its messages visible
4 : Mar 31, 2006 * BufReadPost seems to fire twice; BufReadEnter
only fires once, so the "Source this file..."
message is now issued only once.
3 : Mar 20, 2006 * removed query, now requires sourcing to be
extracted (:so %). Message to that effect
included.
* :VimballList now shows files that would be
extracted.
2 : Mar 20, 2006 * query, :UseVimball included
1 : Mar 20, 2006 * initial release
vim:tw=78:ts=8:ft=help:fdm=marker