Ⅰ. 插件描述
Consistent VimscriptⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'google/maktaba'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'google/maktaba'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'google/maktaba'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/google/vim-maktaba
Ⅳ. 文档说明
Maktaba is a vimscript plugin library. It is designed for plugin authors.
Features include:
- Plugin objects (for manipulating plugins in vimscript)
- Plugin flags (used to configure plugins without global settings)
- Universal logger interface
- Dependency management tools
- Real closures
Maktaba advocates a plugin structure that, when adhered to, gives the plugin
access to many powerful tools such as configuration flags. Within Google, these
conventions standardize behavior across a wide variety of plugins.
Also contained are many utility functions that ease the pain of working with
- This includes, among other things:
- Exception handling
- Variable type enforcement
- Filepath manipulation
Usage example
Maktaba plugins can be installed using any plugin manager. However, maktaba
plugins make heavy use of dependency management, so it's recommended to use a
plugin manager with dependency management capabilities, like
VAM.
Installation of a few plugins using VAM looks something like
set runtimepath+=~/.vim/bundle/vim-addon-manager/
" Loads glaive, vtd, and their maktaba dependency.
call vam#ActivateAddons(['glaive', 'vtd'])
" Initializes all maktaba plugins.
call maktaba#plugin#Detect()
Plugins Using Maktaba
Several vim plugins are
already using maktaba.
As a user, you can generally expect these plugins to be configurable using
Glaive and be more well-behaved in terms of
things like defining unwanted global mappings and variables and avoiding
annoying side-effects like moving your cursor.
Plugin authors should consider developing plugins using maktaba to simplify
code, support modular plugins with hassle-free dependency management, and avoid
common pitfalls. If you've written a plugin using maktaba, please add it to the
list above and share feedback.
Further reading
In the vroom/
directory you'll find literate test files that walk you through
maktaba features in depth. vroom/main.vroom
is a good place to start.
In the examples/
directory you can find an example maktaba plugin to give you
a feel for how maktaba plugins look.
In the doc/
directory you'll find helpfiles for maktaba. These are also
available via :help maktaba
if maktaba has been installed and helptags have
been generated. The help files document the maktaba API in its entirety.