Closed (fixed)
Project:
Vim Plugin For Drupal
Version:
7.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
20 Nov 2011 at 09:01 UTC
Updated:
10 Feb 2012 at 12:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
benjifisherI am not sure where to document this, so I will add it here for now.
I decided to use
$DRUPAL_ROOTfor the environment variable, to mimicdefine('DRUPAL_ROOT', getcwd());in index.php.I have done steps 4 and 5 (slightly modified) and will post a patch to #1328290: Add suppport for javascript and other file types. after some more testing. So far, it works like a charm.
In addition to tag searches, it should be possible to use the tags file for omnicompletion via the PHP completion script included with the vim distro. This may take some work: so far, it only looks for tags in the current buffer, not every file listed in the
'tags'option.Comment #2
benjifisherI just added the two tags files to the project. They are not very useful without the patch I am about to post to #1328290: Add suppport for javascript and other file types., but they are large enough that I could not post them as a patch on that issue. Look there for further usage suggestions.
Exuberant ctags is very ... exuberant. In other words, it includes tags for a bunch of questionable "variables," "functions," etc. Later, I may decide to remove some lines from the tags files.
Comment #4
benjifisherI am reopening this issue because the tags files are too big. Blame it on Exuberant ctags. (See #2 above.)
Obviously, a smaller tags file means smaller downloads and faster tag searches, but the real problem with the big tags files is that they make it harder to find what you want. For example, suppose you want to find the definition of
url(). If you tryin a D7 module, you will find the line
in
includes/batch.inc. If you RTFM about tag searches, you can tryand find that there are 63 different tags for url, of which #4 is the definition of the function.
My solution is to recreate the tags files, adding the option
--php-kinds=-vtoctags. This tells ctags not to create tags for variables. (It will still create tags for constants.)I have been thinking of doing this for a while. I am very reluctant to throw away information, but I have come to the conclusion that this information is just getting in the way.
Please let me know what you think.
Comment #5
benjifisherI am changing the title.
Comment #6
psynaptic commentedWorks great! I tested by applying both patches and running :tag t which took me to the function definition for t().
Comment #7
benjifisherCommitted: http://drupalcode.org/project/vimrc.git/commit/118e377
I have not added any documentation, but I think that comments #1 and #4 above need a more permanent home.
Comment #8
psynaptic commentedAnother tip I only discovered recently is that if you're in the same file as the definition you can use gd to go to the definition. This works for class methods.
Comment #9
benjifisherPerhaps we can add a page to the docs with some tips. Even without any customization, vim has more features than any one person can use.
I think we can do some clever things with the
'define'and'include'options. That will be another issue.