Closed DArcMattr closed 10 years ago
There is g:wordpress_vim_tags_file_name
which can change the name of the tags file. Although it says filename you could use it to place the tags in a subdirectory that is hidden from the public like in wp-admin for instance.
let g:wordpress_vim_tags_file_name = 'wp-admin/tags'
The filename variable almost works. In my particular use case, I go with this kind of file structure for my WordPress projects:
Project Root
wp-config.php
./plugin
./theme
./htdocs
./wp-content
./themes
./simlink-to-theme-folder-in-project-root
./plugins
./simlink-to-plugin-folder-in-project-root
./wp-admin
My preferred choice of parking the tags file is in the project root folder, so I tried setting the tags filename to '../tags', which broke tag searching. Setting the tags location to 'wp-admin/tags' also broke searching.
Yeah that was a bad idea. I think I'm checking for the fileexists so it needs to be a filename.
Changing the tag location to outside the WordPress dir will require maintaining an additional layer, mapping wordpress directories to their tag file locations. Each project would need a custom config, so the global flags won't do.
An easier solution would be to exclude the tags file in a build step.
I will see if I could make it use relative paths, keeping this open for now.
@DArcMattr I've addressed this in 0.1.12
. You can now use relative paths in the wordpress_vim_tags_file_name
option. I've tested with ../tags
as well as .git/tags
both of which work fine. This is done using the --tag-relative
flag of ctags.
One caveat, don't use wp-admin/tags
. ie:- keep the tags file outside of directories that contain files that will be scanned. Ctags gets a bit confused with that kind of nesting.
In the ctags generation code, there doesn't seem to be any user-configurable variables that relate to where the tags file is saved. In the worst case, the tags file is world-viewable on a production site.
Could a setting for this be exposed for users?