0

I'm using vimspector for debugging python, with debugpy. However, I need to source some environment variables before debugging in order for everything to work. How can I set up these env variables before debugging?

In VS code, I used to start the debug. The debug would break, but I could go into the debug terminal, source the env vars, and then it would work.

3
  • Of course I read the documentation before resorting to asking it here. I couldn't find which field, on the json config file, I should use to setup the env variables. I tried some configs, but neither of them worked. Mar 23 at 20:38
  • I did forget my customary welcome, so let me say: Welcome to Vi and Vim! I added the doc links for you and for others; if you've seen them and tried to use them, perhaps you could edit your question to include something like "Based on link and link, I tried XYZ but it didn't work"? I tend to find that plugin questions are better answered by the plugin community, though.
    – D. Ben Knoble
    Mar 23 at 21:12
1

I followed the instructions given by puremourning at https://www.reddit.com/r/vim/comments/mbdt2e/environment_variables_on_vimspector/

I used a shell variable to run a script whose output is the JSON required for the env key; and type coercion to coerce this JSON string into the env map

It is illustrated in puremourning's example:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.