[development] Vim for Drupal request
Victor Kane
victorkane at gmail.com
Sat Aug 1 14:41:30 UTC 2009
Well, the drupal6 directory being there allows me to be taken to the code
itself with the CTRL-[ command, which is not what you were talking about,
but if you do CTRL-[ you get a file not found error.
Anyway I deleted the drupal6 subdir, and everything works fine in terms of
insert, as you say, CTL-x CTL-o works fine in insert mode.
Now, if I type hook_n and do CTRL-x CTRL-o, I get the opening parenthesis.
Then, how do I get the suggested parameters?
Thanks!
Victor
On Sat, Aug 1, 2009 at 11:19 AM, Sam Tresler <sam at treslerdesigns.com> wrote:
> huh. I have no idea why you would need the drupal6 directory there. the
> set tags statement is pointed at the file. Seems like that should make it
> stop working.
>
> However, you should also try in insert mode CTL-x CTL-o in the middle of a
> function, such as hook_a<CTL-x><CTL-o> to get a list of hook_access,
> hook_alter, etc, in order to get the autocomplete functionality. It should
> drop down a lost of hooks and open a buffer with parameters for each hook.
>
> -S
>
> Victor Kane wrote:
>
>> OK, great, Sam, got it working after doing the following:
>>
>> 1. Put in the absolute path in the set tags line in .vimrc as you
>> suggested:
>>
>> set tags ~/.vim/drupal6.tags
>>
>> 2. Copied not just drupal6.tags but the drupal6 directory also to ~/.vim
>>
>> So:
>> victorkane at victorkane:~/.vim$ ls -l
>> total 52
>> drwxr-xr-x 3 victorkane victorkane 4096 2006-10-24 08:08 after
>> drwxr-xr-x 2 victorkane victorkane 4096 2006-10-24 21:59 colors
>> drwxr-xr-x 2 victorkane victorkane 12288 2006-03-17 17:16 colors__
>> drwxr-xr-x 2 victorkane victorkane 4096 2006-10-24 17:41 doc
>> *drwxr-xr-x 3 victorkane victorkane 4096 2009-08-01 11:05 drupal6
>> -rw-r--r-- 1 victorkane victorkane 19644 2009-08-01 08:38 drupal6.tags*
>> drwxr-xr-x 2 victorkane victorkane 4096 2009-07-04 17:31 plugin
>> victorkane at victorkane:~/.vim$
>>
>> Now, when I position my cursor within the phrase "hook_requirements" on
>> the typical "Implementation of hook_requirements" comment in a file I am
>> working on, and do "Ctrl-]" I am automagically taken to the function
>> definition. I get back to where I was with "Ctrl-T".
>>
>> Once again, thanks a lot for this suggestion, and it opens the doors to
>> doing even more with vim!
>>
>> Victor
>>
>> On Sat, Aug 1, 2009 at 10:44 AM, Sam Tresler <sam at treslerdesigns.com<mailto:
>> sam at treslerdesigns.com>> wrote:
>>
>> My mistake Victor, .vimrc needs to take an absolute path change
>>
>>
>> set tags .vim/drupal6.tags
>>
>> to
>>
>>
>> set tags ~/.vim/drupal6.tags
>>
>> if that doesn't work, try manually loading the tags file in vim with
>> :set tags=/home/yourhome/.vim/drupal6.tags and see if it will work
>>
>> Good catch on the hooks/ dir, I re-wrote that to have the -d flag as
>> I wasn't keen on traversing the entire cvs download to get to the file.
>>
>> I'll add .inc files to the vim doc as well, as I believe they aren't
>> there currently.
>>
>> Let me know if that works for you.
>>
>> -S
>>
>> Victor Kane wrote:
>>
>> OK, first of all, thanks so much for the fruits of an idle
>> moment! I use vim all the time now, and this is great.
>>
>> Now, a problem and a solution.
>>
>> I executed the below cvs statement on the command line
>> But since it includes "-d drupal6", it doesn't create a hooks
>> directory, but rather a drupal6 directory.
>> Error:
>> $ ctags -R -o drupal6.tags hooks
>> ctags: Warning: cannot open source file "hooks" : No such file
>> or directory
>>
>> So the following does work:
>>
>> $ ctags -R -o drupal6.tags drupal6
>>
>> Then, you probably want to include .inc files in the list,
>> yielding:
>>
>> if has("autocmd")
>> " Drupal *.module and *.install files.
>> augroup module
>> autocmd BufRead,BufNewFile *.module set filetype=php
>> autocmd BufRead,BufNewFile *.install set filetype=php
>> autocmd BufRead,BufNewFile *.inc set filetype=php
>> set tags=.vim/drupal6.tags
>> augroup END
>> endif
>>
>> However, when editing a file, , Ctrl-] gives error:
>>
>> E433: No tags file
>> E426: tag not found: drupal_get_form Am I missing
>> something?
>>
>> Victor Kane
>> http://awebfactory.com.ar
>>
>> On Fri, Jul 31, 2009 at 6:58 PM, Sam Tresler
>> <sam at treslerdesigns.com <mailto:sam at treslerdesigns.com>
>> <mailto:sam at treslerdesigns.com <mailto:sam at treslerdesigns.com>>>
>> wrote:
>>
>> You know... it said that at the top of the api.drupal.org
>> <http://api.drupal.org>
>> <http://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
>> endif
>>
>> 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 yet.
>>
>> Now what was I doing before this diversion....
>>
>> -S
>>
>>
>>
>>
>> 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>
>> <mailto:sam at treslerdesigns.com <mailto:sam at treslerdesigns.com>>
>> <mailto:sam at treslerdesigns.com
>> <mailto:sam at treslerdesigns.com> <mailto: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> <http://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>>
>> <mailto:sam at treslerdesigns.com
>> <mailto:sam at treslerdesigns.com> <mailto:sam at treslerdesigns.com
>> <mailto:sam at treslerdesigns.com>>>
>> <mailto:sam at treslerdesigns.com
>> <mailto:sam at treslerdesigns.com>
>> <mailto:sam at treslerdesigns.com
>> <mailto:sam at treslerdesigns.com>> <mailto: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>
>> <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
>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/development/attachments/20090801/fcfe0a86/attachment-0001.htm>
More information about the development
mailing list