Ⅰ. 插件描述
Vim snippets for Drupal 7Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'technosophos/drupal-snippets-the-story-of-us'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'technosophos/drupal-snippets-the-story-of-us'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'technosophos/drupal-snippets-the-story-of-us'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/technosophos/drupal-snippets
Ⅳ. 文档说明
# Vim snippets for Drupal 7
This VIM plugin provides Drupal snippets (and minimal configuration) for
coding Drupal modules and themes.
Dependencies
This VIM plugin uses VIM-Snipmate.
It is primarily tested using Janus:
The original version was developed using Pathogen and VIM-Snippets (both
of which are part of Janus):
- pathogen https://github.com/tpope/vim-pathogen
- snipMate fork made by garbas https://github.com/garbas/vim-snipmate
Janus Install
To begin, you may need to create ~/.janus. From there, it's a matter
of cloning this repository:
$ cd ~/.janus
$ git clone git://github.com/technosophos/drupal-snippets.gitYou may need to restart VIM so the new module can load.
Standard (pathogen) install:
Clone the repo in to the ~/.vim/bundle directory.
$ cd ~/.vim/bundle
$ git clone git://github.com/technosophos/drupal-snippets.gitUSAGE
This package providers hundreds of Drupal snippets.
Starters
To start a new *.module file, open the empty file and type newmod.
This will create the necessary module structure.
Similarly, other files can be scaffolded:
newinc: Start a new inc file.newinstall: Scaffold an install filenewinfo: Start a new info file (only works if the extension is
.info).
Hooks:
All core Drupal 7 hook are provided in this package.
- Type
hook_HOOKNAME*<tab>*for annotated snippets. These often contain
additional data structures (like menu items). - Type
h_HOOKNAME*<tab>*for the non-annotated versions. hookwith no name will stub a generic hook callback.
FAPI and Other Structures
fiandfapigenerate basic form items.- For FAPI field types, type fapi_FIELDTYPE<tab>. Example:
fapi_textareaexpands to a full text area definition. miandmenu_itemexpand to menu item arrays.blockiandblock_itemexpand to block items
Utilities:
t,tt, andtttexpand to form various flavors oft(). (Note
thattmay be overridden by the PHP snipmate-snippets file).linkexpands to anl()function.watchdandwatchedog [ERROR|NOTICE|WARNING]expand to various
expansions ofwatchdog().dsmexpands todrupal_set_message().ddump,jdump, andjlogprovide methods of dumping variables.d.oexpands tohttp://drupal.org.
Documentation
Basic documentation is present in the doc/ folder.