I want to move some scripts that I have made to some sort of standalone plugin. The content would look like
myplug/ plugin/ mydefaultdir/
For the scripts, I require a set of files which could have any name. Those are located in
mydefaultdir/. I have a function that list the content of that directory and helps use it in the ensuing script. However, I want to leave to the user the option to select an entirely different directory than the one I am providing. For that I can use
:let g:scriptdir = get(g:, 'scriptdir', "/path/to/plug/mydefaultdir") :call myfunc(g:scriptdir)
However, I cannot be sure where my plugin is located, and hence cannot set the
I suppose I could look to
rtp, but even that would fail if the user decided to rename the plugin directory.
I am assuming that there are better ways to do that (using runtimepath/runtime?). But essentially; it boils down to...
How can a plugin find where it is itself located?