VIM + snipMate and Drupal
I just happened across a very cool little tool the other day for developing code.
I’ve been looking at plugins for VIM recently, and while I really like NERDtree and taglist I just found snipMate. snipMate allows you to enter a snippet of code simply by adding the keyword for the snippet then pressing <TAB>. There are nice snippets for many different languages including PHP, there are even snippets for Drupal which makes developing Drupal modules much faster.
You want to add a drupal_set_message() you would simply type dsm<TAB> and your full drupal_set_message() code will be expanded. You want to add hook_menu to your module, simply type hook_menu<TAB> and your function will be expanded as well as having the ‘hook’ replaced with your module name.
Something that I’ve done in order to use this is in my .vimrc file I’ve added the following:
autocmd BufRead,BufNewFile *.module set filetype=drupal
autocmd BufRead,BufNewFile *.profile set filetype=drupal
autocmd BufRead,BufNewFile *.theme set filetype=drupal
autocmd BufRead,BufNewFile *.install set filetype=drupal
and I created a link in my .vim/syntax directory from php.vim to drupal.vim.
This allows me to create a test.module file which uses php syntax coloring along with using the Drupal snippets.
I’ve created a fork of this project so that I can help with the Drupal 7 hooks and snippets. If you’d like to help, please fork it as well.
Post new comment