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.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 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. hook
with no name will stub a generic hook callback.
FAPI and Other Structures
fi
andfapi
generate basic form items.- For FAPI field types, type fapi_FIELDTYPE**. Example:
fapi_textarea
expands to a full text area definition. mi
andmenu_item
expand to menu item arrays.blocki
andblock_item
expand to block items
Utilities:
t
,tt
, andttt
expand to form various flavors oft()
. (Note thatt
may be overridden by the PHP snipmate-snippets file).link
expands to anl()
function.watchd
andwatchedog [ERROR|NOTICE|WARNING]
expand to various expansions ofwatchdog()
.dsm
expands todrupal_set_message()
.ddump
,jdump
, andjlog
provide methods of dumping variables.d.o
expands tohttp://drupal.org
.
Documentation
Basic documentation is present in the doc/
folder.