[development] Vim for Drupal request

Sam Tresler sam at treslerdesigns.com
Fri Jul 31 21:58:06 UTC 2009

You know... it said that at the top of the api.drupal.org page, but I 
guess it didn't occur to me to actually look...   Thanks.

Works like a charm.  I'd really rather skip the first incarnation I had, 
and just have the hooks loaded.  I'll update the vim docs here shortly, 
but for the record.

$ cvs -z6 
-d:pserver:anonymous:anonymous at cvs.drupal.org:/cvs/drupal-contrib co -r 
DRUPAL-6--1 -d drupal6 contributions/docs/developer/hooks
$ ctags -R -o drupal6.tags hooks
$ mv drupal.tags ~/.vim

(make the .vim directory if you need to)

Then add this to ~/.vimrc

if has("autocmd")
    " Drupal *.module and *.install files.
    augroup module
      autocmd BufRead,BufNewFile *.module set filetype=php
      autocmd BufRead,BufNewFile *.install set filetype=php
      set tags=.vim/drupal6.tags
    augroup END

And you have code-hinting for drupal core in vim.  Just remember to 
update it as you change versions. But it sounds like in Drupal 7 this 
can scrape directly from .api.php files; I haven't even looked at those 

Now what was I doing before this diversion....


Neil Drumm wrote:
> 6.x and 
> lower: http://cvs.drupal.org/viewvc.py/drupal/contributions/docs/developer/hooks/?pathrev=DRUPAL-6--1
> 7.x: *.api.php in module directories.
> -Neil
> On Fri, Jul 31, 2009 at 2:03 PM, Sam Tresler <sam at treslerdesigns.com 
> <mailto:sam at treslerdesigns.com>> wrote:
>     Thanks Neil,
>      Some further digging and I found out that php code completion in
>     vim can map to a ctags output file, which is pretty easy to generate.
>     ctags -R -o drupal6.tags --langmap=php:.module *
>     then load it in vim
>     :set tags=drupal6.tags
>     and you have code complete for every function in core.
>     However, this unfortunately doesn't get code complete on hooks, as
>     they aren't actually named in core, but constructed from
>     modulename_function().
>     So, I guess my next question is where are the hook function
>     definitions from api.drupal.org <http://api.drupal.org> generated?
>     Thanks in advance.
>     -S
>     Neil Drumm wrote:
>         http://api.drupal.org/api/function_dump/6 might have worked at
>         some point. I honestly haven't paid any attention to that page,
>         which might integrate with IDEs; apparently no one else has either.
>         This list is already available in JSON format in the development
>         version of API module. That or another format should be present
>         in the future for an api_filter module to provide an input
>         format filter without running the api module.
>         -Neil
>         On Fri, Jul 31, 2009 at 12:26 PM, Sam Tresler
>         <sam at treslerdesigns.com <mailto:sam at treslerdesigns.com>
>         <mailto:sam at treslerdesigns.com <mailto:sam at treslerdesigns.com>>>
>         wrote:
>            I am working on a drupalcomplete.vim file and would like to
>         generate
>            an list of all of Drupal 6 (and eventually 5,7, etc) functions,
>            objects, and anything else that might warrant code completion.
>            I believe that api.drupal.org <http://api.drupal.org>
>         <http://api.drupal.org> scrapes this
>            automatically from core.  I can manipulate the data to match the
>            format I need no problem, but I thought I would ask here before I
>            went about finding my own way to scrape the data from a cvs
>         checkout.
>            This was broached before here
>          http://lists.drupal.org/pipermail/development/2009-February/032090.html
>            but appears stalled.
>            yes, I have too much time on my hands currently.
>            Cheers. -Sam
>         -- 
>         Neil Drumm
>         http://delocalizedham.com
> -- 
> Neil Drumm
> http://delocalizedham.com

More information about the development mailing list