Clone the repo in to the ~/.vim/bundle directory.
$ cd ~/.vim/bundle
$ git clone git://github.com/technosophos/drupal-snippets.git
Add the following to .vimrc:
Bundle 'sanguis/drupal-snippets'
Then run :BundleInstall
This package providers hundreds of Drupal snippets.
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
).All core Drupal 7 hook are provided in this package.
hook_HOOKNAME*<tab>*
for annotated snippets. These often contain
additional data structures (like menu items).h_HOOKNAME*<tab>*
for the non-annotated versions.hook
with no name will stub a generic hook callback.fi
and fapi
generate basic form items.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 itemst
, 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
.Basic documentation is present in the doc/
folder.