oni icon indicating copy to clipboard operation
oni copied to clipboard

Exporting an environment variable

Open Melkor333 opened this issue 8 years ago • 3 comments

Hey guys

I want to create a custom SpaceVim configuration file located in ~/.config/oni/SpaceVim.d/init.toml. SpaceVim uses the environment variable $SPACEVIMDIR for a custom configuration dir and I want to set that variable when Oni is started.

I saw that environment.additionalPaths changes an environment variable, would it make sense to create another variable like environment.additionalVariables which takes an associative array?

And as an extra, it would be cool if I could set the the variable to be something along $oni_config_path/SpaceVim.dbut this is really just unnecessary fancy.

Melkor333 avatar Jun 06 '18 17:06 Melkor333

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

oni-bot avatar Jun 06 '18 17:06 oni-bot

@Melkor333 we've had a fairly long history (or rather that was the first issue I encountered when I discovered oni) trying to get Oni to reflect the user's path and env the same way that the terminal does. We previously were overiding the env whenever we spawned a process e.g. for language server etc. and it turned out that over time it led to a few issues such as #1665 and #1706, I've currently got a PR open #2274 to try to add a more conservative version of the initial functionality to override the PATH on startup just once but was actually thinking theoretically we can just as easily set the env on startup as I think our issues were related to setting it continuously.

Not sure what @bryphe would think about that as he discovered the original bug #1665 but I think if we are careful and minimal about overriding (aka once in a controlled way) it we should able to avoid the issue we had.

Re. a config setting that in itself I think that could be added hopefully fairly straightforwardly, @bryphe we could create a sub object in the user config and merge that into the env in the function that handles setting it.

Regarding the setting though my preference (for what its worth) would be just getting oni to correctly set the PATH and env, which spares the user the overhead of having to maintain special env vars for oni or reproduce them in oni's config because oni doesn't pick them up, seems like adding code on top of but not addressing the root problem and given our connection to neovim, at its core a terminal program, things like this our bound to keep popping up.

akinsho avatar Jun 06 '18 20:06 akinsho

Okay I've given up on trying to make SpaceVim work with oni and created #2322 instead. And @Akin909 you're probably right it makes more sense to just set env variables outside of Oni.

Melkor333 avatar Jun 19 '18 16:06 Melkor333