I'm trying to add a plugin that will provide additional tags files to look up the documentation of a language: https://github.com/DanielSiepmann/phpstorm-stubs/blob/feature/add-dynamic-tags-file/plugin/php.vim But none of my tries worked out:
let &l:tags += expand('%:p:h:h') . "/tags"
let &tags = expand('%:p:h:h') . "/tags"
set tags += expand('%:p:h:h') . "/tags"
The first solution returns the following error:
Error detected while processing /Users/siepmann/.dotfiles/.vim/bundle/phpstorm-stubs/plugin/php.vim: line 1: E734: Wrong variable type for += Press ENTER or type command to continue
The second one will prevent all other defaults that would be set in addition. So tags=./tags,tags
will become tags=~/Projects/typo3/tags
where ~/Projects/typo3/
is current working dir.
The thing is that the plugin should ship with the tags file and as the plugin can be installed into multiple locations the include should be dynamic.
So what will be a working solution / approach?
.
, so you should use.=
to add to a string value.._
the right way even iftags
is a list of values. In my opinion vimdoc.sourceforge.net/htmldoc/options.html#:set+= should apply.set
, don't use spaces, i.e. useset tags+=<path>
. Also, if you want to get a path relative to the script file it's run from, try something likelet parent_dir = resolve(expand('<sfile>:p:h'))
for example, and use that.<sfile>
in the docs.