drupal-snippets


Ⅰ. 插件描述

Vim snippets for Drupal 7

Ⅱ. 基本信息

创建日期:  2010-10-24
使用用户:  3
Github星:  10
插件作者:  Matt Butcher

Ⅲ. 安装方法

使用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

Stability: Unsupported

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):

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.git

You 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.git

USAGE

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 file
  • newinfo: 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.
  • hook with no name will stub a generic hook callback.

FAPI and Other Structures

  • fi and fapi generate basic form items.
  • For FAPI field types, type fapi_FIELDTYPE<tab>. Example:
    fapi_textarea expands to a full text area definition.
  • mi and menu_item expand to menu item arrays.
  • blocki and block_item expand to block items

Utilities:

  • t, tt, and ttt expand to form various flavors of t(). (Note
    that t may be overridden by the PHP snipmate-snippets file).
  • link expands to an l() function.
  • watchd and watchedog [ERROR|NOTICE|WARNING] expand to various
    expansions of watchdog().
  • dsm expands to drupal_set_message().
  • ddump, jdump, and jlog provide methods of dumping variables.
  • d.o expands to http://drupal.org.

Documentation

Basic documentation is present in the doc/ folder.

添加新评论