1

I want to use multiple globals in different functions in vimscript but I get the following error:

"Cannot do :global recursive"

To my problem: I have a config file with paths to multiple XML-files. I want to use a global for every path in the config file and a global for every tag in each XML-File.

So I have some thing like this:

global search-for-a-file-path call functionX(filepath)

functionX(filepath)

edit filepath

global search-for-tags call functionThatDoesStuff()

functionThatDoesStuff()

Stuff happens here...

Is there a possibility to make this work with globals or do I need to use a different approach?

P.S.: I already saw this Q&A but it did not help me because I use the globals in different functions and the solution only shows how it is done in a "one-liner".

1 Answer 1

1

Vimscript does simply not seem to be able to do it, so I came up with the following solution:

while search("the-thing-I-search-for") > 0
   call functionThatDoesStuff()
end while

My thanks go to Martin for help on the matter.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.