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.<br><br>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.<br>
<br>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?<br><br>Thanks!<br><br>Victor<br><br><div class="gmail_quote">On Sat, Aug 1, 2009 at 11:19 AM, Sam Tresler <span dir="ltr"><<a href="mailto:sam@treslerdesigns.com">sam@treslerdesigns.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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.<br>
<br>
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.<br>
<br>
-S<br>
<br>
Victor Kane wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
OK, great, Sam, got it working after doing the following:<br>
<br>
1. Put in the absolute path in the set tags line in .vimrc as you suggested:<br>
<br>
set tags ~/.vim/drupal6.tags<br>
<br>
2. Copied not just drupal6.tags but the drupal6 directory also to ~/.vim<br>
<br>
So:<br>
victorkane@victorkane:~/.vim$ ls -l<br>
total 52<br>
drwxr-xr-x 3 victorkane victorkane 4096 2006-10-24 08:08 after<br>
drwxr-xr-x 2 victorkane victorkane 4096 2006-10-24 21:59 colors<br>
drwxr-xr-x 2 victorkane victorkane 12288 2006-03-17 17:16 colors__<br>
drwxr-xr-x 2 victorkane victorkane 4096 2006-10-24 17:41 doc<br>
*drwxr-xr-x 3 victorkane victorkane 4096 2009-08-01 11:05 drupal6<br>
-rw-r--r-- 1 victorkane victorkane 19644 2009-08-01 08:38 drupal6.tags*<br>
drwxr-xr-x 2 victorkane victorkane 4096 2009-07-04 17:31 plugin<br>
victorkane@victorkane:~/.vim$<br>
<br>
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".<br>
<br>
Once again, thanks a lot for this suggestion, and it opens the doors to doing even more with vim!<br>
<br>
Victor<br>
<br></div><div><div></div><div class="h5">
On Sat, Aug 1, 2009 at 10:44 AM, Sam Tresler <<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a> <mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>>> wrote:<br>
<br>
My mistake Victor, .vimrc needs to take an absolute path change<br>
<br>
<br>
set tags .vim/drupal6.tags<br>
<br>
to<br>
<br>
<br>
set tags ~/.vim/drupal6.tags<br>
<br>
if that doesn't work, try manually loading the tags file in vim with<br>
:set tags=/home/yourhome/.vim/drupal6.tags and see if it will work<br>
<br>
Good catch on the hooks/ dir, I re-wrote that to have the -d flag as<br>
I wasn't keen on traversing the entire cvs download to get to the file.<br>
<br>
I'll add .inc files to the vim doc as well, as I believe they aren't<br>
there currently.<br>
<br>
Let me know if that works for you.<br>
<br>
-S<br>
<br>
Victor Kane wrote:<br>
<br>
OK, first of all, thanks so much for the fruits of an idle<br>
moment! I use vim all the time now, and this is great.<br>
<br>
Now, a problem and a solution.<br>
<br>
I executed the below cvs statement on the command line<br>
But since it includes "-d drupal6", it doesn't create a hooks<br>
directory, but rather a drupal6 directory.<br>
Error:<br>
$ ctags -R -o drupal6.tags hooks<br>
ctags: Warning: cannot open source file "hooks" : No such file<br>
or directory<br>
<br>
So the following does work:<br>
<br>
$ ctags -R -o drupal6.tags drupal6<br>
<br>
Then, you probably want to include .inc files in the list, yielding:<br>
<br>
if has("autocmd")<br>
" Drupal *.module and *.install files.<br>
augroup module<br>
autocmd BufRead,BufNewFile *.module set filetype=php<br>
autocmd BufRead,BufNewFile *.install set filetype=php<br>
autocmd BufRead,BufNewFile *.inc set filetype=php<br>
set tags=.vim/drupal6.tags<br>
augroup END<br>
endif<br>
<br>
However, when editing a file, , Ctrl-] gives error:<br>
<br>
E433: No tags file<br>
E426: tag not found: drupal_get_form Am I missing something?<br>
<br>
Victor Kane<br>
<a href="http://awebfactory.com.ar" target="_blank">http://awebfactory.com.ar</a><br>
<br>
On Fri, Jul 31, 2009 at 6:58 PM, Sam Tresler<br>
<<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a> <mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>><br></div></div><div class="im">
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a> <mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>>>><br>
wrote:<br>
<br></div><div><div></div><div class="h5">
You know... it said that at the top of the <a href="http://api.drupal.org" target="_blank">api.drupal.org</a><br>
<<a href="http://api.drupal.org" target="_blank">http://api.drupal.org</a>><br>
<<a href="http://api.drupal.org" target="_blank">http://api.drupal.org</a>> page, but I guess it didn't occur to<br>
me to<br>
<br>
actually look... Thanks.<br>
<br>
Works like a charm. I'd really rather skip the first<br>
incarnation I<br>
had, and just have the hooks loaded. I'll update the vim<br>
docs here<br>
shortly, but for the record.<br>
<br>
<br>
$ cvs -z6<br>
-d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib<br>
co<br>
-r DRUPAL-6--1 -d drupal6 contributions/docs/developer/hooks<br>
$ ctags -R -o drupal6.tags hooks<br>
$ mv drupal.tags ~/.vim<br>
<br>
(make the .vim directory if you need to)<br>
<br>
Then add this to ~/.vimrc<br>
<br>
if has("autocmd")<br>
" Drupal *.module and *.install files.<br>
augroup module<br>
autocmd BufRead,BufNewFile *.module set filetype=php<br>
autocmd BufRead,BufNewFile *.install set filetype=php<br>
set tags=.vim/drupal6.tags<br>
augroup END<br>
endif<br>
<br>
And you have code-hinting for drupal core in vim. Just<br>
remember to<br>
update it as you change versions. But it sounds like in Drupal 7<br>
this can scrape directly from .api.php files; I haven't even<br>
looked<br>
at those yet.<br>
<br>
Now what was I doing before this diversion....<br>
<br>
-S<br>
<br>
<br>
<br>
<br>
Neil Drumm wrote:<br>
<br>
6.x and lower:<br>
<a href="http://cvs.drupal.org/viewvc.py/drupal/contributions/docs/developer/hooks/?pathrev=DRUPAL-6--1" target="_blank">http://cvs.drupal.org/viewvc.py/drupal/contributions/docs/developer/hooks/?pathrev=DRUPAL-6--1</a><br>
7.x: *.api.php in module directories.<br>
<br>
-Neil<br>
<br>
On Fri, Jul 31, 2009 at 2:03 PM, Sam Tresler<br>
<<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a> <mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a> <mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>>><br></div></div><div class="im">
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>> <mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>>>>><br>
wrote:<br>
<br></div><div><div></div><div class="h5">
Thanks Neil,<br>
Some further digging and I found out that php code<br>
completion in<br>
vim can map to a ctags output file, which is pretty<br>
easy to<br>
generate.<br>
<br>
ctags -R -o drupal6.tags --langmap=php:.module *<br>
<br>
then load it in vim<br>
<br>
:set tags=drupal6.tags<br>
<br>
and you have code complete for every function in core.<br>
<br>
However, this unfortunately doesn't get code complete on<br>
hooks, as<br>
they aren't actually named in core, but constructed from<br>
modulename_function().<br>
<br>
So, I guess my next question is where are the hook<br>
function<br>
definitions from <a href="http://api.drupal.org" target="_blank">api.drupal.org</a><br>
<<a href="http://api.drupal.org" target="_blank">http://api.drupal.org</a>> <<a href="http://api.drupal.org" target="_blank">http://api.drupal.org</a>><br>
<<a href="http://api.drupal.org" target="_blank">http://api.drupal.org</a>> generated?<br>
<br>
<br>
Thanks in advance.<br>
<br>
-S<br>
<br>
<br>
<br>
<br>
Neil Drumm wrote:<br>
<br>
<a href="http://api.drupal.org/api/function_dump/6" target="_blank">http://api.drupal.org/api/function_dump/6</a> might have<br>
worked at<br>
some point. I honestly haven't paid any attention<br>
to that<br>
page,<br>
which might integrate with IDEs; apparently no one<br>
else<br>
has either.<br>
<br>
This list is already available in JSON format in the<br>
development<br>
version of API module. That or another format<br>
should be<br>
present<br>
in the future for an api_filter module to provide<br>
an input<br>
format filter without running the api module.<br>
<br>
-Neil<br>
<br>
On Fri, Jul 31, 2009 at 12:26 PM, Sam Tresler<br>
<<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>> <mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>>><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>> <mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>>>><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>>> <mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a><br>
<mailto:<a href="mailto:sam@treslerdesigns.com" target="_blank">sam@treslerdesigns.com</a>>>>>><br>
<br>
wrote:<br>
<br>
I am working on a drupalcomplete.vim file and would<br>
like to<br>
generate<br>
an list of all of Drupal 6 (and eventually 5,7,<br>
etc)<br>
functions,<br>
objects, and anything else that might warrant code<br>
completion.<br>
<br>
I believe that <a href="http://api.drupal.org" target="_blank">api.drupal.org</a><br>
<<a href="http://api.drupal.org" target="_blank">http://api.drupal.org</a>> <<a href="http://api.drupal.org" target="_blank">http://api.drupal.org</a>><br>
<<a href="http://api.drupal.org" target="_blank">http://api.drupal.org</a>><br>
<<a href="http://api.drupal.org" target="_blank">http://api.drupal.org</a>> scrapes this<br>
<br>
automatically from core. I can manipulate the<br>
data to<br>
match the<br>
format I need no problem, but I thought I would ask<br>
here before I<br>
went about finding my own way to scrape the<br>
data from<br>
a cvs<br>
checkout.<br>
<br>
This was broached before here<br>
<a href="http://lists.drupal.org/pipermail/development/2009-February/032090.html" target="_blank">http://lists.drupal.org/pipermail/development/2009-February/032090.html</a><br>
but appears stalled.<br>
<br>
yes, I have too much time on my hands currently.<br>
<br>
Cheers. -Sam<br>
<br>
<br>
<br>
<br>
-- Neil Drumm<br>
<a href="http://delocalizedham.com" target="_blank">http://delocalizedham.com</a><br>
<br>
<br>
<br>
<br>
-- Neil Drumm<br>
<a href="http://delocalizedham.com" target="_blank">http://delocalizedham.com</a><br>
<br>
<br>
<br>
</div></div></blockquote>
</blockquote></div><br>